iPhone Character Spacing

落花浮王杯 提交于 2019-12-24 10:07:19

问题


Is there a way to add character spacing in UILabel?

I found some examples like: How to change an UILabel/UIFont's letter spacing?

But it's hard to believe that there isn't a easier way.


回答1:


There is no other to achieve what you want than doing custom Quartz drawing, UILabel is not flexible enough. However, other people have taken on the challenge, there is for example OHAttributedLabel which allows you to set an NSAttributedString as the label's text. Try the NSKernAttributeName, it modifies kerning but I've never tried this on iOS, only OS X.




回答2:


In IB you can click on Adjust to fit and (In font size), and set lines to '0' in in layout, to achieve near to your requirement.(or you can do it by code too).



来源:https://stackoverflow.com/questions/6785129/iphone-character-spacing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!