问题
I am trying to change the font of a label to "Museo_500italic.otf" I have imported it to my project and added it to the p-list, but it doesn't recognize the font. I've done it with other fonts, a couple of months ago, but this one for some reason isn't working. Am I forgetting something?
This is what I've got:
This gives me Museo-500 for a font:
self.createAccTxt.font = [UIFont fontWithName:@"Museo-500" size:17.5];
These give me the default font:
self.createAccTxt.font = [UIFont fontWithName:@"Museo-500Italic" size:17.5];
self.createAccTxt.font = [UIFont fontWithName:@"Museo-500_Italic" size:17.5];
self.createAccTxt.font = [UIFont fontWithName:@"Museo-500-Italic" size:17.5];
self.createAccTxt.font = [UIFont fontWithName:@"Museo-500italic" size:17.5];
self.createAccTxt.font = [UIFont fontWithName:@"Museo-500_italic" size:17.5];
self.createAccTxt.font = [UIFont fontWithName:@"Museo-500-italic" size:17.5];
回答1:
In your fontWithName:
calls, the string with the font name needs to be precisely as it's written in the "Font Book" app, as part of OSX.
来源:https://stackoverflow.com/questions/13922705/custom-font-not-being-set-iphone