Custom fonts in Mac sdk using storyboard

放肆的年华 提交于 2019-12-12 07:24:11

问题


How to add a custom font to storyboard in Mac app development. I went through some blogs and tried by adding font book and develop one NStextfield using this custom font using storyboard. But it is system dependent. I created the DMG and install in another computer it uses the default font. I did it programmatically, but my requirement is through storyboard. Please help me on this


回答1:


I spent a bit of time trying to figure this out and found the solution in this related question.

In your info.plist file, which you made available to me at

It turns out you can safely get rid of the "Fonts Provided By Application" section (it's an iOS specific key and is ignored by macOS).

And for "Application Fonts resource path", make certain you have the font going into a "Fonts" folder (or some subfolder within your application bundle's Resources folder).

Lastly, do a custom copy build phase like this:

This is copying the font into the "Fonts" subfolder specified in your "Application Fonts resource path". You don't want the font in your Resources folder, but you do want it in a subfolder underneath Resources.



来源:https://stackoverflow.com/questions/44786741/custom-fonts-in-mac-sdk-using-storyboard

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