gpt4 book ai didi

ios - MFMailComposeViewController Bar titleText 和 UIbarbuttons 不使用外观代理提供的自定义字体

转载 作者:搜寻专家 更新时间:2023-10-30 22:19:00 26 4
gpt4 key购买 nike

我在“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 模拟器中,我可以看到自定义字体一段时间,但它恢复为默认字体。

enter image description here

在 iPhone Simulator 5S 中显示了一段时间。 (我正在努力做到这一点)

enter image description here

几秒后使用默认字体。

有什么帮助吗?外观代理不应该也适用于 MFMailComposeViewController 的 UIBarButton 和 NavigationBar 还是需要为此进行任何编码?

我正在使用 Swift,也尝试使用 Alexander 使用 Bridge 的 appearanceWhenContainedIn,但似乎没有用。我关心的是更改 MFMailComposeViewController 的 titleText 和 BarButtonItems(取消,发送)的字体。

提前致谢。任何帮助将不胜感激。

最佳答案

在过去的几天里,我一直在与 iOS 9 设备发生同样的问题。我已经尝试了几乎一切。但是,今天早上我将尝试将以下内容添加到 AppDelegate:

UIBarButtonItem.appearanceWhenContainedInInstancesOfClasses([MFComposeViewController.self]).setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.blueColor()], forState: .Normal)

我不能使用 UINavigationBar 类,因为它会影响整个应用程序的外观,而这不是我想要的。

如果有效,我会回复。

关于ios - MFMailComposeViewController Bar titleText 和 UIbarbuttons 不使用外观代理提供的自定义字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32431762/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com