iOS 中的 CTLineGetTypgraphicBounds —— 上升和下降总是返回为零
在 NSAttributedString 的 iOS 类别中,我有以下内容:
CTLineRef line = CTLineCreateWithAttributedString((CFAttributedStringRef)self);
CGFloat ascent;
CGFloat descent;
double length = CTLineGetTypographicBounds(line, &ascent, &descent, NULL);
// at this point, ascent and descent always come back as zero.
根据文档,这些应该是线的上升和下降。但他们不是。
宽度不返回零。
也就是说,如果我接着画线,它就画得很好。
我错过了什么吗?
In an iOS category on NSAttributedString, I have the following:
CTLineRef line = CTLineCreateWithAttributedString((CFAttributedStringRef)self);
CGFloat ascent;
CGFloat descent;
double length = CTLineGetTypographicBounds(line, &ascent, &descent, NULL);
// at this point, ascent and descent always come back as zero.
According to the docs, it appears that these should be the ascent and descent of the line. But they aren't.
The width is not returning zero.
That said, if I then draw the line, it draws just fine.
Am I missing something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论