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

I am trying to make two fonts in one UITextView, how to do it?

+4
source share
4 answers

You cannot have two on the same page because they are not supported. Just use web browsing and HTML file

+4
source

From the class link :

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

+5
source

You can know how to use this using the attributedText property of UITextView. It is available in iOS 6.

+1
source

UITextView supports only one font, but there is another topic: Can I use multiple font styles in a UITextView?

If the text you want to draw is simple, I would suggest subclassing UITextView or UIView by overwriting the drawRect function and working with some additional variables. This only works if you have a very predictable font system.

Another option is to use several shortcuts, which probably need even more predictable customization.

0
source

All Articles