标签:
方法1:
CGSize labelSize = [label中文本的内容(text) boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width - 10, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]} context:nil].size;
方法2:
CGSize maxSize = CGSizeMake(MAXFLOAT, MAXFLOAT);
CGSize size = [text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:fontSize]} context:nil].size;
iOS开发之----根据文本内容和字体大小计算UILabel的size
标签:
原文地址:http://www.cnblogs.com/fs-ios/p/4705576.html