1. Add MTImageMapView.h and MTImageMapView.m file in Project 2. Add BridgeHeader File #import “MTImageMapView.h” 3. Add Custom Class MTImageMapView in UIImageView 4. Add Image and Coordinate .plist file in Project coordinate file added to image different coordinate location 4. Outlet of UIImageVIew @IBOutlet weak var imgView: MTImageMapView! var …
iPhone
UICollectionView Auto Slider
Collection view auto scroll Data Like (Slider) Collection view scroll automatically next page every 3.0 seconds First Outlet Of CollectionView @IBOutlet weak var cvWeeklyDeals: UICollectionView! 2. creating Timer to call every 3.0 seconds call to method func startTimer() { let timer = Timer.scheduledTimer(timeInterval: 3.0, …
UITableView – Reverse Pagination
As a solution i found that we need to transform our UITableview. So all the contents in the UItableview are transformed. You need to transform Cell, You need to implement header instead of footer and vice-versa. We need much more time to do this, so …
Change format of date/string like 5:00 to 05:00
-(NSString *)setDateInFormat:(NSString *)strTxt { NSArray *arr = [strTxt componentsSeparatedByString:@”:”]; NSString *str = [arr objectAtIndex:0]; if ([str length] < 2) { if (![str hasPrefix:@”0″]) { …
Compress image without changing image dimensions
We have to write a single line to compress the image at a time when we are uploading our image to a server. NSData *dataForPNGFile = UIImageJPEGRepresentation(imgPicked, 0.0f); 0.0f is the maximum & 1.0f is the minimum compress ratio we can change based on our …
Use UIView as UIButton…..
Give UIControl class to UIView then we can access that as UIButton.Add event like Touch Up Inside, touchDown… etc.
CLLocationManager not getting City name
Issue Description : I have not getting city name when select some of location. To overcome this issue use below snippet code. – (void) getReverseGeocode { CLGeocoder *geocoder = [[CLGeocoder alloc] init]; if(currentLatLong.count > 0) { CLLocationCoordinate2D myCoOrdinate; myCoOrdinate.latitude = LatValue; myCoOrdinate.longitude = LangValue; CLLocation …
Continue run application in background mode without suspended by OS.
We can solve this by using background task and runloop mechanism. Below piece of code can save your day for problem like run app in background continue. Initialise var UIBackgroundTaskIdentifier var bgTask:UIBackgroundTaskIdentifier! bgTask = application.beginBackgroundTaskWithName(“MyTask”, expirationHandler: {() -> Void …
Download & Store files in documents directory iOS phone-gap application
Hello, Here is the code for download and store files in document directory ios phone-gap app. var fileTransfer = new FileTransfer(); fileTransfer.download( uri, filePath, function(entry) { alert(“download complete: ” + entry.toURL()); } }, function(error) { alert(“download error source ” + error.source); alert(“download error target ” …
DFP Banner & Interstitial Ads in iOS
//DFPBannerView //ViewController.h 1. @import GoogleMobileAds 2. @property (nonatomic, weak) IBOutlet DFPBannerView *bannerView; 3. Design UIView which custom class is DFPBannerView //ViewController.m – (void)viewDidLoad { [super viewDidLoad]; NSLog(@”Google Mobile Ads SDK version: %@”, [DFPRequest sdkVersion]); self.bannerView.adUnitID = @”/6499/example/banner”; //To get your own adUnitID refer reference links …