Since iOS 6, UIKit supports drawing attributed strings, so no extension or replacement is needed.
From UILabel
:
@property(nonatomic, copy) NSAttributedString *attributedText;
You just need to build up your NSAttributedString
. There are basically two ways:
Append chunks of text with the same attributes - for each part create one NSAttributedString
instance and append them to one NSMutableAttributedString
Create attributed text from plain string and then add attributed for given ranges – find the range of your number (or whatever) and apply different color attribute on that.