Reputation: 8944
I am using custom font in iOS.For using custom font i have followed below steps.
Print font name using below code
for (NSString *fontFamilyName in [UIFont familyNames]) {
for (NSString *fontName in [UIFont fontNamesForFamilyName:fontFamilyName]) {
NSLog(@"Family: %@ Font: %@", fontFamilyName, fontName);
}
}
Font name is
self.label_co.font = [UIFont fontWithName:@"Digital-7Mono" size:20];
I am able to see font name in font name list in storyboard.I am able to use font on storyboard on interface builder but when i run the app custom font is not shown
Upvotes: 2
Views: 605
Reputation: 4410
Making UITextview "selectable" from storyboard will work. But text is selectable. Another way to do this is Attributed.
Upvotes: 0
Reputation: 134
Remove the Mono from Digital-7Mono in Bundle and info.plist.give everywhere as Digital-7.it was worked me.
self.label_co.font = [UIFont fontWithName:@"Digital-7" size:20];
Upvotes: 0
Reputation: 3093
Some times font is not copy in "Copy Bundle Resources" so please do and may be same issue happen in your case.
so Tap on you project target->Build Phases->Copy Bundle Resources
and see font file exist or not, if font file not exist add the font to bundle resources using +
button sign at bottom, press it and add font file to resources. Thats it now check it you can got results :)
OR
As per your Edited answer you used Digital-7 mono font so you have to write it like this.
self.label_co.font = [UIFont fontWithName:@"Digital-7" size:20];
instead of
self.label_co.font = [UIFont fontWithName:@"Digital-7Mono" size:20];
This will definitely worked.
Upvotes: 1
Reputation: 409
Click your font in the xcode project and in the right side property window, you'll see an option like Target membership. Make sure whether it is checked for your app. Hope it helps :)
Upvotes: 0