Reputation:
Suppose I have text like this in a label
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
How do I change the colour of the the sentence "At vero eos et..." starting in the second line?
Upvotes: 0
Views: 159
Reputation: 1686
I don't believe this is possible with the UILabel class. However, it wouldn't be too hard to do this with some simple HTML in a UIWebView.
[myWebView loadHTMLString:@"Some normal text. <font color=\"red\">Some red text.</font>" baseURL:nil]
Let me know if this works well for you.
Upvotes: 1
Reputation: 34912
You can't do that with a standard UILabel
. You'd either have to use multiple UILabel
s or take a look at CoreText which would also do what you want - http://developer.apple.com/library/mac/#documentation/StringsTextFonts/Conceptual/CoreText_Programming/Introduction/Introduction.html.
Upvotes: 1