Custom font not being set, iPhone

核能气质少年 提交于 2019-12-23 05:04:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!