I’d like different words in a UILabel to be different colors. Does this mean each word will need to be a different UILabel? I’m guessing yes, though sure would be nice to just put color codes in the label somehow, you know? I guess I’m a bit spoiled by text markup in HTML.
Share
There is no proper
UIRichTextViewin iOS. It’s high on my wish-list for iOS 6 (and there’s some reason to believe we may get it then due to the release of Pages).Your options are to use multiple
UILabelviews, NSString UIKit Additions, Core Text,UIWebView, or one of a few third-party frameworks such as:All of the current solutions have different problems. The most common problem is that it’s hard to get select and copy functionality to work with rich text unless you use a web view. Web views are incredibly annoying because they’re asynchronous and you have to do a lot of your interactions in JavaScript.
I wish there were a better answer.
(Obligatory shilling: This topic is covered in depth in Chapter 18 of iOS 5 Programming Pushing the Limits.)