views:

203

answers:

3

I have a text which looks like the following,


the url of the page is http://www.myurl.com, and the phone # is (999)999-9999, blah blah blah...

And I want to show it in a way such that the URL and the phone # are both in different color and bolded. Can I do it using just one UILabel control, or I need to parse them out and put them onto separate UILabel controls. (Note that the text itself could span multiple lines.) How can I do it?

A: 

You could use an NSAttributeString to decorate your string. There is a good explanation of how to use them here http://stackoverflow.com/questions/2090226/change-the-background-color-of-a-substring-of-a-drawn-nsstring/2090253#2090253

darren
A: 

Sorry I forgot to mention that this is for iPhone (CoCoa Touch), where the NSAttributedString is not available.

tom
You should delete this answer and move it to your original post.
Austin Hyde
A: 

You could try using a UIWebView, which detects both URLs and phone numbers.

Rudy