在返回cell高度的TableView的协议里调用如下方法:
- (CGFloat)heightForString:(NSString *)aString size:(NSInteger)size{
NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:size]};
CGRect rect = [aString boundingRectWithSize:CGSizeMake(300, 100000) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
return rect.size.height;
}
// 返回值就是高度