Change color of Back button in navigation bar

后端 未结 26 2269
孤街浪徒
孤街浪徒 2020-12-02 05:58

I am trying to change the color of the Settings button to white, but can\'t get it to change.

I\'ve tried both of these:

navigationItem.leftBarButton         


        
26条回答
  •  误落风尘
    2020-12-02 06:07

    Swift 4.2

    Change complete app theme

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
            // Override point for customization after application launch.
    
            UINavigationBar.appearance().tintColor = .white
    
            return true
        }
    

    Change specific controller

    let navController = UINavigationController.init(rootViewController: yourViewController) 
    navController.navigationBar.tintColor = .red
    
    present(navController, animated: true, completion: nil)
    

提交回复
热议问题