Reputation: 27
Is it possible to make some text in the same UILabel in different colour and different size?
I want it different colour in the same label, is it possible? I mean in one label have many colour of text,
Upvotes: 0
Views: 642
Reputation: 38757
Since iOS6, you can use the attributedText property of the UILabel to achieve multi colours.
Upvotes: 0
Reputation: 64428
You change the text color like this:
myLabel.textColor=[UIColor blueColor];
You change font like:
myLabel.font= aFont; //a font object you've previously defined.
Edit01: Upon rereading, it appears the OP wants to change text attributes within the same string. In that case, you will need to use CFAttributedString. I haven't used it but I believe it works on the iPhone.
Upvotes: 0
Reputation: 8339
iPhone doesn't have NSAttributedString, and it's pretty obvious that UILabel doesn't have a way to specify per-character attributes. So I think your only answer is to use WebKit (UIWebView).
Upvotes: 1