Monday 24 December 2012

Set Italic and Bold Font to UILable and anything else...



You have to actually ask for the bold, italic version of a font. For example:
UIFont *myFont = [UIFont fontWithName:@"Helvetica-BoldOblique" size:[UIFont systemFontSize]];
To get a list of everything available on the iPhone, put this little snippet in yourapplicationDidFinishLaunching: delegate method and look at the log output:
for (NSString *family in [UIFont familyNames]) {
    NSLog(@"%@", [UIFont fontNamesForFamilyName:family]);
}
Note: Some font names say "oblique" - this is the same as italic.
I can't see a built-in way of doing underlines - you may have to draw the line yourself.

No comments:

Post a Comment