How can i have a UILabel with two different colors for the font? I will have text in two different strings and i want to make text with first string as red and second as green. The length of both the string is variable.
Try TTTAttributedLabel. It's a subclass of UILabel that supports NSAttributedStrings, which would make it easy to have multiple colors, fonts, and styles in the same string.
Edit: Alternatively, if you don't want the 3rd party dependency and are targeting iOS 6, UILabel now has the attributedText property.
You can't do this within a UILabels. But my suggestion is that instead of using multiple UILabel just concentrate on NSAttributedString. Find UIControllers that draw NSAttributedString because UILabel, UITextView do not support NSAttributedString.
PS: if you plan to distribute an iOS6 or later application, as UILabel now support NSAttributedString, you should use UILabel directly instead of OHAttributedLabel as it is now natively supported by the OS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With