解决方法
我最后用这个为我工作这不适用于IBOutlets对象,但在uitableview的heightForRowAtIndexPath:method动态计算文本的高度时很有用.
NSDictionary *attributesDictionary = [NSDictionary dictionaryWithObjectsAndKeys: [UIFont fontWithName:@"FontName" size:15],NSFontAttributeName,nil]; CGRect frame = [label.text boundingRectWithSize:CGSizeMake(263,2000.0) options:NSStringDrawingUsesLineFragmentOrigin attributes:attributesDictionary context:nil]; CGSize size = frame.size;