Kerning in iOS UITextView

前端 未结 6 943
北海茫月
北海茫月 2020-12-22 18:33

For what apparently is a \'bug,\' UITextView does not seem to support kerning like other UIKit Elements. Is there a workaround to get kerning working?

To be clear, I

6条回答
  •  执念已碎
    2020-12-22 19:08

    After researching this a bit I found that the reason for the missing Kerning is that UITextView internally uses a UIWebDocumentView which has Kerning turned off by default.

    Some infos about the inner workings of UITextView: http://www.cocoanetics.com/2012/12/uitextview-caught-with-trousers-down/

    Unfortunately there is no sanctioned method to enable Kerning, I would definitely advise against using a hack using a camouflaged selector.

    Here's my Radar, I suggest you dupe it: http://www.cocoanetics.com/2012/12/radar-uitextview-ignores-font-kerning/

    In this I argue that when setting text on UITextView via setAttributedText we developers expect for Kerning to be on by default because that is how it would most closely match output of rendering the text via CoreText.

提交回复
热议问题