Can't change custom UIFont size on the UIButton
Seems like your UIFont object isn't getting created correctly and is returning nil
.
This is the best tutorial I have found on putting in custom fonts. Good luck ;)
http://refactr.com/blog/2012/09/ios-tips-custom-fonts/ (Archived Version)
Do this:
NSMutableDictionary *fontsByFamilyName = [NSMutableDictionary dictionary];
NSArray *sortDescriptors = [NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"self" ascending:YES] autorelease]];
NSArray *familyNames = [[UIFont familyNames] sortedArrayUsingDescriptors:sortDescriptors];
for (NSString *aFamilyName in familyNames) {
NSArray *fontNames = [[UIFont fontNamesForFamilyName:aFamilyName] sortedArrayUsingDescriptors:sortDescriptors];
[fontsByFamilyName setObject:fontNames forKey:aFamilyName];
NSLog(@"fonts :%@", fontsByFamilyName);
}
Look for the "iOS" name of your font... I found my cusom ones with this method. If you don't, let's check how you added your font (maybe a action forgotten). Source: http://forgecode.net/2010/08/uifont-name-grabber/
To get the font name you have to pass in fontWithName:size:
, open your font with Font Book app, then look up for the PostScript name
property. Make shure you have added it to Info.plist
file too.