STEP 1: Open your storyboard in Xcode 8 and choose an initial device view. Make changes as you normally would. STEP 2: Once you have completed your changes, select the storyboard -> File Inspector -> Opens in -> Select ‘Xcode 7.x’. STEP 3: Select ‘Save …
Custom notification in iOS 10 or greater
After iOS 10 version you can also display images, GIF or videos in your notification. you need to do following things in your project. Step 1 : Add NotificationServiceExtension in your project targets. step 2 : Write following code in your NotificationServiceExtension.swift file. import UserNotifications …
Parse Your BLE Peripheral Device Characteristic in HEX String
#pragma mark – Peripheral Delegates – (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error { if (error) NSLog(@”Error reading BLE data: %@”,[error localizedDescription]); else [self parseBLEMessage:characteristic.value]; } – (void)parseBLEMessage:(NSData*)pobjData { NSData *objData = pobjData; NSString *strValue = [getHexString:objdata]; } -(NSString*)getHexString:(NSData*)pdata { NSMutableString *sbuf; NSUInteger capacity = self.length …
UITableViewCell does not set according to text/components after using UITableViewAutomaticDimension
To overcome this issue we have to set layout of the cell after inserting any values into cell. Refer below code: -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { CustomTableViewCell *cellCustom = (CustomTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cellCustom == nil) { cellCustom = [[CustomTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } …
AlamofireObjectMapper
Step 1: Install POD pod ‘AlamofireObjectMapper’ Step 2: Make Models import ObjectMapper class WeatherResponse: Mappable { var location: String? var threeDayForecast: [Forecast]? required init?(map: Map){ } func mapping(map: Map) { location <- map[“location”] …
How to use Alamofire(Any pods) with iOS Widget
Your widget is another project, along with the main application that runs the widget, in your workspace. So you need to install Alamofire in one (or both, depending on your needs). Change your podfile to following code: source ‘https://github.com/CocoaPods/Specs.git’ platform :ios, ‘9.0’ use_frameworks! target “MainAPP” …
Update Autolayout constraint with animation
First set your constraint to your view and than layoutIfNeeded in animation. // let say there is one object of UIView in storyboard/xib and you have set auto layout to that particular view. Now, if suppose you have to set bottam constraint accourding to your …
Dynamic data binding in table phone-gap app
When you add data dynamically in table, You have to “refresh” table after data append otherwise it does not display data in table. Simple you need to write following line in your java-script file. $(“#your_table_id”).table(“refresh”);
Reusable cell issue.
override func prepareForReuse() { super.prepareForReuse() btnAccept.hidden = true }//This method is also helpful when you get multiple redundant images.
Clear Cache Memory
override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated.. removeCacheMemmory() } func removeCacheMemmory(){ SDWebImageManager.sharedManager().imageCache.clearMemory() SDWebImageManager.sharedManager().imageCache.clearDisk() SDImageCache.sharedImageCache().cleanDisk() SDImageCache.sharedImageCache().clearMemory() NSURLCache.sharedURLCache().removeAllCachedResponses() }