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]; } …
iPhone
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 …
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() }
3D Touch
– (void)viewDidLoad { [self registerForPreviewingWithDelegate:self sourceView:MyView]; } #pragma mark UIViewControllerPreviewingDelegate – (UIViewController*)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location { UIView *ViewTouch = previewingContext.sourceView; UIViewController *ViewNew = [self.storyboard instantiateViewControllerWithIdentifier:@”demo1″]; return ViewNew; } – (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext commitViewController:(UIViewController *)viewControllerToCommit { [self.navigationController pushViewController:viewControllerToCommit animated:YES]; }
Touch ID Authenticate
LAContext *context = [[LAContext alloc] init]; NSError *error = nil; if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) { [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@”Login with Touch ID” reply:^(BOOL success, NSError *error) { if (error) { UIAlertView *Alert = [[UIAlertView alloc] initWithTitle:@”Login” message:@”Login Fail” delegate:self cancelButtonTitle:@”Close” otherButtonTitles:nil, nil]; [Alert show]; } if …
SetBadge on UITabBarController
Make Extension of UITabBarController extension UITabBarController { func setBadges(badgeValues: [Int]) { for view in self.tabBar.subviews { if view is CustomTabBadge { view.removeFromSuperview() } } for index in 0…badgeValues.count-1 { if badgeValues[index] …
Getting error while adding APNS certificate to Firebase
To overcome this issue while creating an app on Firebase select proper bundle identifier, if you are using com.inheritx.pushnotification for creating apple push notification certificate than writing com.inheritx.pushnotification while configuring an application on Firebase bundle identifier.