我已经在UINavigationController文件中自定义了/设置了AppDelegate.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
}


这是我的模拟器的图像:

ios - 导航 Controller 自定义不对应-LMLPHP

最佳答案

我假设您是在谈论UINavigationBar.appearance().tintColor不影响标题字体的颜色。字体的颜色可以通过UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]更改

要更改状态栏的颜色,还必须在View controller-based status bar appearance中添加info.plist键,并将其值设置为NO

关于ios - 导航 Controller 自定义不对应,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34578826/

10-13 05:01