我收到一条警告:“'sizeWithFont:constrainedToSize:lineBreakMode:' 已弃用:iOS 7.0 中首次弃用”有人可以建议我使用这种方法吗?
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
// Calculate height based on cell content — cell content will stretch appropriately when the height is set
Post *post = self.articleComments[indexPath.row];
CGFloat width = tableView.frame.size.width - 71 - 15; // Width of comment text area
UIFont *commentFont = [UIFont fontWithName:@"SeroCompPro-Light" size:14];
CGFloat commentTextHeight = [post.text sizeWithFont:commentFont constrainedToSize:CGSizeMake(width, 10000) lineBreakMode:NSLineBreakByWordWrapping].height;
return commentTextHeight + 31 + 37;
}