一直以来用的是这个,但是ios7之后一直报黄色,受不了
NSString *aString = roomInfo.introduction;
CGSize titleSize = [aString sizeWithFont:[UIFont systemFontOfSize:14] constrainedToSize:CGSizeMake(self.width-24, MAXFLOAT)];
有强迫症的话,用这个就OK了
NSDictionary *attribute = @{NSFontAttributeName: [UIFont systemFontOfSize:14]};
CGSize titleSize = [aString boundingRectWithSize:CGSizeMake(self.width-24, 0) options: NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:attribute context:nil].size; |