我已在 AppDelegate.swift
文件中自定义/设计了我的 UINavigationController
。我的代码中没有错误。不过,当我在内置模拟器中运行代码时,这些更改不会显示。我该如何解决? (我正在使用 swift 代码。)
这是我的AppDelegate.swift
代码:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Changing the navigation controller's background colour
UINavigationBar.appearance().barTintColor = UIColor(red: 0.0/255.0, green: 165.0/255.0, blue: 227.0/255.0, alpha: 1.0)
// Changing the navigation controller's text/bar button item colour
UINavigationBar.appearance().tintColor = UIColor.whiteColor()
// Changing the tint colour of the tab bar icons
UITabBar.appearance().tintColor = UIColor(red: 0.0/255/0, green: 165.0/255.0, blue: 227.0/255.0, alpha: 1.0)
// Changing the status bar's colour to white
UIApplication.sharedApplication().statusBarStyle = .LightContent
return true
}
这是我的模拟器的图像:
最佳答案
我假设您正在谈论 UINavigationBar.appearance().tintColor
不影响标题字体的颜色。字体颜色可以通过 UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
更改
要更改状态栏的颜色,您还必须添加 View controller-based status bar appearance
您的 key info.plist
并将其值设置为 NO
.
关于ios - 导航 Controller 定制不对应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34578826/