UILabel 与 CATextLayer 性能对比
我想知道在表视图单元格中使用 UILabel 实例与 CATextLayers 的性能差异。虽然 UILabel
由于界面生成器的支持而非常方便,并且具有一些附加功能,例如提供阴影的方式,但 CATextLayer
可以访问更多字体,并且应该成为更靠近图形硬件的一层(原文如此!)。顺便说一句,有谁知道 UILabel
是否可能在内部使用 CATextLayer
?
为了将便利性和对更多字体的访问结合起来,可以从 UILabel
派生,将图层类更改为 CATextLayer
并根据标签配置图层属性特性。如果标签的 drawRect()
为空,那么这应该不会有太大的惩罚(除了额外的 UIView
惩罚),不是吗?
I wonder about the performance differences of using UILabel
instances vs. CATextLayers in my table view cells. While UILabel
is very convenient thanks to the support in interface builder and has some a additional features such as a way to provide a shadow, CATextLayer
has access to more fonts and is supposed to be one layer(sic!) nearer to the graphics hardware. Btw., does anyone know whether UILabel
might internally be using CATextLayer
s?
To combine both the convenience and the access to more fonts, it might be possible to derive from UILabel
, change the layer class to CATextLayer
and configure the layer properties based on the label properties. If the label's drawRect()
is empty, this should not have much of a penalty (apart from the additional UIView
penalty), should it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论