How to save 2 different fonts in one UITextField or UITextView?

I want to set 2 different fonts within the same UITextField and UITextView . How to do it?

+4
source share
5 answers

A bit of work - you will need to use Core Text and NSAttributedString to do this.

There are many tutorials and examples, although I would suggest using another subclass of UILabel already made, for example:

OHAttributedLabel

or

TTAttributedLabel

As usual, some convenient methods make processing easier.

+6
source

I would do this with two overlay text fields, both backgroundcolor: clearColor, and overlaid on the image representing the background.

+1
source

I do not think that it is possible to process 2 different fonts within the same UITextField or UITextView. If you want to have a different font style, you can set a different font style in UIWebView or use the coreText API.

Here are some links that might help:

0
source

I know that you have already chosen the correct answer, but ... do not do it this way ... it is not worth it. Instead, use webview and draw everything with html.

0
source

In the interface editor, change the Text box text field to an attribute. In this small editor that appears, you can change the font / format / color of the selected text, for example, in any advanced text editor.

0
source

All Articles