Reputation: 4589
I am having trouble with getting the name of my custom font. I added font to my project with copy if needed option checked. I added the font name to the info.plist tag Fonts provided by an application. I added the font to Copy Bundle Resources.
The font appears in storyboard under custom tab. But when I try to find the name of this font with code, it doesn't work. Really strange because that normally works. What could be the reason for this?
Storyboard image of font:
Code to find the name programatically:
viewDidLoad(){
// there is no PTSans family in the debugger.
for family: String in UIFont.familyNames()
{
print("\(family)")
for names: String in UIFont.fontNamesForFamilyName(family)
{
print("== \(names)")
}
}
}
Upvotes: 3
Views: 1302
Reputation: 27052
Btw, see the difference in example, the font name has a space, in actual there isn't.
Upvotes: 9
Reputation: 3447
Did you try something like:
[yourlabel setFont:[UIFont fontWithName:@"PT Sans" size:20]];
Upvotes: 1