我想在我的應用程序中添加和使用字體。我已經按照這個帖子作爲參考,但我不能得到它的工作。如何在我的xcode項目中添加和使用自定義字體
我已將字體Frutiger95UltraBlack.ttf
添加爲支持文件,然後將其添加到我的{app-name} -Info.plist中。
然後嘗試在我的應用程序代理中使用它來更改我的UINavegationBar
但沒有任何反應。
我在想什麼?
[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
[UIFont fontWithName:@"Frutiger95UltraBlack" size:16.0], UITextAttributeFont,nil]];
'[UIFont fontWithName:...]更換
UITextAttributeTextColor
'要求*的PostScript名*字體作爲參數,這可能是從文件名不同的。也許單獨調用該方法來檢查字體是否已加載。 –@MartinR這解決了我的問題。請發佈它作爲答案,謝謝 –
我很高興它有幫助,答案補充說。 –