We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
比较了NSAttributedString自带的文字高度计算方法
open func boundingRect(with size: CGSize, options: NSStringDrawingOptions = [], context: NSStringDrawingContext?) -> CGRect
和YYTextLayout的文字高度计算方法
let layout = YYTextLayout(container: textContainer, text: attributedTitle)! let height = layout.textBoundingRect
还有TextKit的文字高度计算方法
发现只有NSAttributedString自带的文字高度计算方法返回的高度是最准确的
The text was updated successfully, but these errors were encountered:
是不是使用了非系统字体?我发现在 iOS 13 下使用了非系统字体的话,YYText 计算的高度就不准确
Sorry, something went wrong.
是的,我们APP都是自定义字体,Core Text 、TextKit和YYText算出来的高度都不准确,YYText底层就是基于Core Text计算的吧!
跟你一样的,我们也使用了自定义字体,目前我使用的是 TTTAttributeLabel 来做展示。快要上线了,我们测试发现,iOS 13 下,有空白行的文字高度计算有问题,但是使用系统提供的 boundingRect 方法就可以计算出来。 目前我的解决方法是:iOS 13 下,使用系统提供的 boundingRect 计算,然后加一个常量值(这个值就需要你自己去慢慢试了)
No branches or pull requests
比较了NSAttributedString自带的文字高度计算方法
和YYTextLayout的文字高度计算方法
还有TextKit的文字高度计算方法
发现只有NSAttributedString自带的文字高度计算方法返回的高度是最准确的
The text was updated successfully, but these errors were encountered: