我有以下代码来计算 UITableView 单元格的高度。
UIFont *textFont = [SettingsManagerUI defaultFontItalicWithSize:14];
UIView *tempView = [[UIView alloc] init];
UITextView *locationText = [[UITextView alloc] init];
UITextView *moreInfoText = [[UITextView alloc] init];
[tempView addSubview:locationText];
[tempView addSubview:moreInfoText];
[locationText setFont:textFont];
[moreInfoText setFont:textFont];
NSString *locationDetails = [MembersSavePartnerDetailsMoreInfoTableCell generateLocationTextWithPartner:partner inLocation:location];
locationText.text = locationDetails;
NSString *moreInfo = partner ? partner.partnerDescription : location.partner.partnerDescription;
moreInfoText.text = moreInfo;
float locationTextHeight = locationText.contentSize.height;
float moreInfoTextHeight = moreInfoText.contentSize.height;
在 iOS 5.1.1 中,locationTextHeight
是 88 和moreInfoTextHeight
= 52。在 iOS 6 中,高度分别是 1420 和 2482。
为什么 iOS 6 中的高度不同,我该如何解决这个问题?