Unable to display selected text with different colors in UITextView, what should I do?

I want to display texts in a UITextView with different colors and underline some of them (to show that they are wrong - usually done in spellchecker), but this is not possible in the current version of UIKit. What other options should I use?

I am thinking of subclassing UIScrollView (as I deal with a lot of texts) and blit text in UIView (as content) using CoreGraphics, and as I enter new text I will overlay new text on it. Is this a good approach?

+4
source share
1 answer

The recommended approach is to generate HTML and use UIWebView. This is a type of scrolling, so you should have all the necessary functionality.

If you want more control over the text, your approach is good, although you can probably use the UIKit NSString extensions to draw your text. In particular, you want drawAtPoint: withFont:

+2
source

All Articles