开发者

How do you have two fonts in one UITextView (Xcode)?

I'm开发者_开发百科 trying to make two font styes in one UITextView, how do I do this?


From the class reference:

This class does not support multiple styles for text. The font, color, and text alignment attributes you specify always apply to the entire contents of the text view. To display more complex styling in your application, you need to use a UIWebView object and render your content using HTML.


You cannot have two on the same page because it is not supported. Just use a webview and an HTML file


You can know use this by using the attributedText property of UITextView. This is available under iOS 6


UITextView supports just a single font, but there's a different topic on something similar: Can I use multiple font style in UITextView?

If the text you want to draw is simple, I'd suggest subclassing UITextView or UIView, overwriting the drawRect function and work with some extra variables of your own. This only works if you have a very predictable system to the fonts though.

Another option is using multiple labels, which would probably need an ever more predictable setup.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜