- - (CGFloat)heightForBoundingWidth:(CGFloat)width font:(UIFont *)font
- {
- NSAttributedString *attributedSelf = [[NSAttributedString alloc] initWithString:self attributes:@{ NSFontAttributeName:font }];
- return [attributedSelf boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size.height;
- }
字符串的 宽高计算
最新推荐文章于 2017-02-15 16:50:24 发布