I know this subject has been run into the ground, however I have tried every solution I've found on StackOverflow to fix this issue, and its just not working for some reason. I am creating a UILabel
programmatically, then using this font. The UILabel
is rendering but not in the font I want it to (looks like its defaulting to something)
First I imported two .ttf fonts into the xcode project under a folder called "Resources". The two fonts are Gotham Book and Gotham Book Italic (GothaBoo.ttf, GothaBooIta.ttf)
Then, I added a line to the [my app]-Info.plist file called "UIAppFont", added two rows to the array, Item 0 | String | GothaBoo, Item 1 | String | GothaBooIta.
I checked the Target Build Phases, under Copy Bundle Resources, and made sure the two fonts were in there.
Then, I simply added this code to the viewDidLoad routine:
UILabel *myLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(50, 100, 200, 100)];
myLabel1.text = @"Hello";
myLabel1.backgroundColor = [UIColor clearColor];
myLabel1.font = [UIFont fontWithName: @"GothaBoo" size: 48.0];
myLabel1.textColor = [UIColor blackColor];
[self.view addSubview:myLabel1];
No dice. What on earth am I doing wrong? The project is in Xcode 4.3.2, for the iPad, running 5+ of iOS