I am implementing a functionality in which all labels of my cell has been resized as per the text containing with each label.I have implemented this functionality with the help of RayWanderlich tutorial and its working fine for iPhone 4s,5 and 5s with iOS 8.1. as shown in image below which shows iPhone 5s simulator with iOS 8.1
while I am running my app with iPhone 6 or iPhone 6 plus I got unexpected behavior as shown below image which shows iPhone 6 simulator
and iPhone 6 plus simulator.
I have created two custom cell nib files one for iPhone 4,4s,5 and 5s and second one is for iPhone 6 and 6 plus. As I am new with auto layout I have set constraints same both nibs. I am showing both custom cell nib files with set constraints at below images.
iPhone 4,4s,5 and 5s nib file snapshot
iPhone 6 and iPhone 6 plus Custom cell nib file snapshot
I also used following code snippet from where cell has been resized with dynamic height. The code works for iPhone iPhone 4(for iOS 7),4s,5 and 5s (for iOS 7 and iOS 8 and 8.1) fine but not for iPhone 6 and iPhone 6 plus.
Code Snippet
- (CGFloat)calculateHeightForConfiguredSizingCell_3:(MemberListTableViewCell_WithoutImage_3_iPhone *)sizingCell {
sizingCell.bounds = CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.tblView.frame), CGRectGetHeight(sizingCell.bounds));
[sizingCell setNeedsLayout];
[sizingCell layoutIfNeeded];
CGSize size = [sizingCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
//CGSize size = [sizingCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize withHorizontalFittingPriority:UILayoutPriorityDefaultHigh verticalFittingPriority:UILayoutPriorityDefaultHigh];
return size.height + 1.0f; // Add 1.0f for the cell separator height
}
Please give me a proper solution where am I going wrong.I have surfed lot of things but unable to get proper way to solve this issue. Your help would be appreciable.Thanks in advanced.