gpt4 book ai didi

ios - 为导航栏设置色调颜色恢复为 iOS 6 蓝色

转载 作者:行者123 更新时间:2023-11-29 10:52:32 28 4
gpt4 key购买 nike

我有一个 iOS 6 应用程序,它使用以下方法将所有导航栏按钮的色调颜色设置为绿色:

[[UIBarButtonItem appearance] setTintColor:[UIColor colorWithRed:(100.0f/255.0f) green:(190.0f/255.0f) blue:(100.0f/255.0f) alpha:1.0f]];

这是在应用程序启动时完成的。这在运行 iOS 6 的手机上运行良好,但在运行 iOS 7 的手机上,色调有时存在有时不存在。它尤其发生在显示 AlertView 时。这会消除任何显示正确绿色色调的按钮的色调,并将按钮恢复为标准的 iOS 6 蓝色色调。

为了确认这不是我在我的大型项目中所做的事情,我创建了一个基本模板 Master-detail xcode 项目来确认并只添加了上面的行和一个 alertview 弹出窗口,这也发生在那里。

我想知道是否有 1.) 其他人遇到过这个问题 2.) 如果有,您找到解决方法了吗 3.) 是否有人知道 Apple 是否已确认这是一个错误。

目前我们不打算将此应用程序转换为 iOS 7 外观,因此这不是一个选项。谢谢。

最佳答案

来自苹果官方文档:

In iOS 6, tintColor tinted the background of navigation bars, tab bars, toolbars, search bars, and scope bars. To tint a bar background in iOS 7, use the barTintColor property instead.

您应该引用完整的 UI 转换指南,了解哪些 UI 元素在 iOS 7 中以不同的方式表现。如果您想要同时支持两者,您可以检查 iOS 版本并为每个版本放置不同的代码:

if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier
} else {
// Load resources for iOS 7 or later
}

关于ios - 为导航栏设置色调颜色恢复为 iOS 6 蓝色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19866093/

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