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?
-
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
-
Sorry I forgot to mention that this is for iPhone (CoCoa Touch), where the NSAttributedString is not available.
Austin Hyde : You should delete this answer and move it to your original post. -
You could try using a UIWebView, which detects both URLs and phone numbers.
0 comments:
Post a Comment