Reputation: 39988
Hello I'm trying this tutorial. This my piece of code
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIFont *font = [UIFont fontWithName: @"Bangla MN" size: 12];
NSLog(@"%@",font);
[mTextField setFont: font];
[mTextField setFont:font];
}
It's giving null in log. Here is sample project that I'm developing
Upvotes: 0
Views: 374
Reputation: 16864
below is the code for the displaying the custom font Displaying
UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(10, 30, 240, 40)];
[label1 setFont: [UIFont fontWithName: @"Grinched" size:24]];
[label1 setText:@"Grinched Font"];
[[self view] addSubview:label1];
UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectMake(10, 80, 240, 40)];
[label2 setFont: [UIFont fontWithName: @"Energon" size:18]];
[label2 setText:@"Energon Font"];
[[self view] addSubview:label2];
Upvotes: 0
Reputation: 499
If you already included it into project and correctly added into .plist, then make sure, that you use correct font name. You have to know, that sometime font name is not equal to font's filename
UPD:
Solution were found. You just forgot to include your font file in TestApp target membership. After including - everything works fine.
Upvotes: 5
Reputation: 42
Before do any stuff, check for this!
1] Check the name of the font you given.
2] Type exactly as "file name of font".
3] Check if that font is exist in your XCode IDE. To Check click on your label > properties > Text Font > Custom > Check your font into list!
Hope this helpful! All the best!
Upvotes: 0