tags:

views:

47

answers:

2

Is there an easy way to change a single characters color in a textview?

Thanks!

A: 

No, that's impossible. Use a UIWebView instead, it will give you all the flexibility html has to offer.

mvds
so i would have to write it in html...But i need access to an NSArray and i dont not know html...what about underlining it or making it stand out somehow?
@shorty: that sounds like a different question! btw, HTML is quite easy to learn, I think.
mvds
i just need my text to stand out visible somehow....
A: 

You can, but you'll have to resort to an undocumented method, so I suggest you do this just for fun, not for an app that you're going to sell on AppStore:

[theTextView setContentToHTMLString: content];

Here, content is a NSString that contains HTML markup, allowing you to assign it to something like "<font color='red'>T</font>he first letter of this text is red and the letter <font color='green'>Z</font> here is green".

luvieere
Will apple really reject that since its undocumented?
@shorty876 I've recently done a school project using the method, it proved more trouble than it was worth. I'd advise you to use it with care, it actually is private for a reason. As to the rejection, the use of undocumented API may be sometimes a harbinger of trouble from this point of view.
luvieere
hmm its more complicated than i thought. meh i can find an alternative...