Can I set the attributedText
property of a UILabel
object? I tried the below code:
UILabel *label = [[UILabel alloc] init];
label.attributedText = @"asdf";
But it gives this error:
Property "attributedText" not found on object of type 'UILabel *'
#import <CoreText/CoreText.h>
not working
Unfortunately, You can use OHAttributedLabel instead.UILabel
doesn't support attributed strings.
Update: Since iOS6, UILabel
does support attributed strings. See UILabel reference or Michael Kessler's answer below for more details.