I know this question was running, but I tried to use every solution I found on StackOverflow to fix this problem and it just doesn't work for some reason. I am creating program code UILabel, then using this font. UILabelis a rendering, but not in the font that I want (looks like its default)
First, I imported two .ttf fonts into the xcode project under the Resources folder. Two fonts - 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 lines to the array, Item 0 | String | GothaBoo, Item 1 | String | GothaBooIta.
I checked the phases for creating the target in the Bundle Copy Resources section, and made sure that there were two fonts.
Then I just added this code to the viewDidLoad procedure:
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 am I doing wrong? The project is in Xcode 4.3.2, for iPad running on 5+ iOS
source
share