我正在将我的应用更新到iOS 7,终于搞定了,但有一件事情我找不到解决方法。
在Xcode 4中,我使用了以下方法:
#define FONT_SIZE 14.0f
#define CELL_CONTENT_WIDTH 280.0f
#define CELL_CONTENT_MARGIN 10.0f
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; {
NSString *text = [textA objectAtIndex:[indexPath row]];
CGSize constraint = CGSizeMake(CELL_CONTENT_WIDTH - (CELL_CONTENT_MARGIN * 2), 20000.0f);
CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];
CGFloat height = MAX(size.height, 28.0f);
return height + (CELL_CONTENT_MARGIN * 2);
}
但是在iOS 7中使用它时,会出现错误:
请使用-boundingRectWithSize:options:attributes:context:
我不知道如何将我的早期版本转换为这种新方法,如果有人能帮忙,那就太好了。提前感谢。