Multi-colored UILabel text

南楼画角 提交于 2019-12-06 14:07:46

You are correct that you need to use a UIWebView. Alternatively, you can draw the text yourself into a custom view, but that would probably be a lot more difficult to implement.

If you are going to draw it yourself, you'll want to use the drawing methods in NSString UIKit Additions along with the -[UIColor set] method etc.

Rendering the text using HTML in a UIWebView is the recommended method from apple.

Another solution is to concatenate an array of UILabels each with their own individual settings (such as text colour). In your case the label would be broken into labels as [The ][q][uick ][b][rown fox].

Pcasso

CoreText can be successfully used in many applications.

We can do it using CoreText Framework,You can study further more using this link CoreText Tutorial for iOS

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