方式一:
NSMutableAttributedString *attStr = [NSMutableAttributedString new]; CGSize attSize = [attStr boundingRectWithSize:CGSizeMake(UIScreen.mainScreen.bounds.size.width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil].size; CGFloat height = size.height;
NSMutableAttributedString *attStr = [NSMutableAttributedString new];
CGSize attSize = [attStr boundingRectWithSize:CGSizeMake(UIScreen.mainScreen.bounds.size.width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil].size;
CGFloat height = size.height;
方式二:
NSMutableAttributedString *attStr = [NSMutableAttributedString new]; CGFloat height = [label sizeThatFits:CGSizeMake(UIScreen.mainScreen.bounds.size.width, CGFLOAT_MAX)].height;
NSMutableAttributedString *attStr = [NSMutableAttributedString new];
CGFloat height = [label sizeThatFits:CGSizeMake(UIScreen.mainScreen.bounds.size.width, CGFLOAT_MAX)].height;
猜你喜欢
网友评论
- 搜索
- 最新文章
- 热门文章