简体   繁体   中英

Custom fonts in Xcode 6 - Swift don't work

I'm trying to use a custom font in my Xcode iOS project I am working on. It is written in swift and I am planning to change the font for the navigation bar. In the app delegate file I was trying to use this code: UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName : Futura-Medium, size: 20,)] but it has not worked.

The font is present in the p list and build phase as well as being targeted to the current project. Could anyone shed some light on how I may be able to get around this? Thanks

检查以下语法:

 UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName : UIFont(name: "Futura-Medium", size: 20)!, NSForegroundColorAttributeName : UIColor.whiteColor()];

你不是说:

UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName : UIFont(name:"Futura-Medium", size: 20)!];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM