Reputation: 4582
I can't find a simple example anywhere. Here's where my code is at currently...
(Note: name is a UILabel, fontWithCTFont comes from a category of UIFont)
CTFontRef helveticaBold = CTFontCreateWithName(CFSTR("Helvetica-Bold"), 24.0, NULL);
[name setFont:[UIFont fontWithCTFont:helveticaBold]];
Upvotes: 0
Views: 2417
Reputation: 32681
[attrStr addAttribute:(NSString*)kCTUnderlineStyleAttributeName value:[NSNumber numberWithInt:style] range:range];
where style is a bitwise-mask combination of CTUnderlineStyle
and CTUnderlineStyleModifiers
values.
See my OHAttributedLabel
class on github, and especially my NSAttributedString+Attributes
category
Upvotes: 2