计算有label有多少行
作者:
frola_ | 来源:发表于
2018-01-23 15:00 被阅读0次 CGRect rect = [wellKnowSayingLabel.text boundingRectWithSize:CGSizeMake(SCREENWIDTH-50, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20]} context:nil];
CGSize textSize = [wellKnowSayingLabel.text sizeWithAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:20]}];
NSUInteger textRow = (NSUInteger)(rect.size.height / textSize.height);
NSLog(@"label有%@行",textRow);//行数
本文标题:计算有label有多少行
本文链接:https://www.haomeiwen.com/subject/viusaxtx.html
网友评论