ios - 导航 Controller 定制不对应

标签 ios swift uinavigationcontroller appdelegate

我已在 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/

相关文章:

ios - swift - NSMangedObjectContext 不刷新数据

swift - 实例成员不能用于类型 |闭包

ios - Swift 停止卸载表格 View 单元格?

ios - Parse "Get Data In Background With Block"无法解决的错误

ios - iPad 导航 Controller 工具栏位置

iphone - 使用 NSXMLParser 解析 HTML,而不是 iPhone 中的完整数据

ios - Swift:ViewController 中的 TableView

ios - XCode 5.1.1 iOS 7.1 将数据发送到任一先前的 Controller

ios - 如何检测是否从导航 Controller 弹出 View Controller ?

ios - 强制 ui 导航 Controller 仅纵向