UILabel default kerning different from CATextLayer

后端 未结 3 2112
天命终不由人
天命终不由人 2021-02-08 00:19

I have a UILabel with the string \'LA\'. I also have a CATextLayer with the same characters in an NSAttributedString assigned to its

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-08 01:04

    UIKit generally uses WebKit for its text rendering (as visible in this crash log), most likely for performance reasons. If you really need super-precision then there are some custom UILabel reimplementations using CoreText as its back-end.

    EDIT: As of iOS7 this is no longer true since UILabel uses TextKit for its rendering which is based on CoreText as well.

提交回复
热议问题