标签:ios boudingrectwithsize:options:attributes:context
iOS7新出了一个boudingRectWithSize:options:attributes:context方法 计算文本尺寸:
NSString* desc = @"想过string";
NSDictionary *attribute = @{NSFontAttributeName: [UIFont systemFontOfSize:13]};// 文字的大小
CGSize size = [desc boundingRectWithSize:CGSizeMake(100, 0)
options: NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin |
NSStringDrawingUsesFontLeading
attributes:attribute context:nil].size;
得出size的宽高
本文出自 “羊仔” 博客,请务必保留此出处http://5934497.blog.51cto.com/5924497/1652611
标签:ios boudingrectwithsize:options:attributes:context
原文地址:http://5934497.blog.51cto.com/5924497/1652611