我已使用" applicationDidFinishLaunching"中的外观代理将UIBarButtonItem和UINavigationBar titleTextAttributes的外观更改为我的自定义字体以及颜色变为白色。每个导航标题文本和BarButtonItems都使用提供的自定义字体。
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
application.setStatusBarStyle(UIStatusBarStyle.LightContent, animated: false)
UINavigationBar.appearance().barStyle = UIBarStyle.BlackTranslucent
UINavigationBar.appearance().barTintColor = NSFontAttributeName:SharedHelper.myCustomBarColor()
UINavigationBar.appearance().titleTextAttributes =[NSForegroundColorAttributeName:UIColor.whiteColor()]
UIBarButtonItem.appearance().tintColor = UIColor.whiteColor()
let attributes = [NSFontAttributeName:SharedHelper.customFontForBarButton()]
UIBarButtonItem.appearance().setTitleTextAttributes(attributes, forState: UIControlState.Normal)
return true
}
当我使用MFMailComposeViewController发送电子邮件时出现问题。 MFMailComposeViewController忽略字体属性并恢复为默认字体。在iPhone 5S模拟器中,我可以看到一段时间的自定义字体,但它会恢复为默认字体。
在iPhone模拟器5S中显示一段时间。 (我想要完成这个)
几秒钟后使用默认字体。
对此有何帮助?不应该是UIBarButton& amp;的外观代理工作。 MFMailComposeViewController的NavigationBar也是如此,或者是否需要对此进行编码?
我正在使用Swift,并尝试使用外观使用Bridge的AlexanderContainedIn,但似乎没有效果。我关心的是改变MFMailComposeViewController的titleText和BarButtonItems(取消,发送)的字体。
提前致谢。任何帮助都将受到高度赞赏。
答案 0 :(得分:0)
过去几天我一直在与iOS 9设备争论同样的问题。我几乎尝试过所有事情。但是,今天早上我将尝试将以下内容添加到AppDelegate:
UIBarButtonItem.appearanceWhenContainedInInstancesOfClasses([MFComposeViewController.self]).setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.blueColor()], forState: .Normal)
我无法使用UINavigationBar类,因为它会影响整个应用程序外观,而这不是我想要的。
如果有效,我会回复。