CGSize size = [xxx sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:14.0f]}];
CGSize adjustedSize = CGSizeMake(ceilf(size.width), ceilf(size.height));
转载于:https://www.cnblogs.com/tongyuling/p/4834796.html
本文介绍了一种使用Swift语言计算富文本字符串尺寸的方法,通过设置字体属性并利用系统API进行尺寸计算,最后调整尺寸以适应布局需求。
CGSize size = [xxx sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:14.0f]}];
CGSize adjustedSize = CGSizeMake(ceilf(size.width), ceilf(size.height));
转载于:https://www.cnblogs.com/tongyuling/p/4834796.html
2148

被折叠的 条评论
为什么被折叠?