Change color of Back button in navigation bar

后端 未结 26 2224
孤街浪徒
孤街浪徒 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:09

    Lets try this code:

     func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.
    
        let navigationBarAppearace = UINavigationBar.appearance()
        navigationBarAppearace.tintColor = UIColor.whiteColor()  // Back buttons and such
        navigationBarAppearace.barTintColor = UIColor.purpleColor()  // Bar's background color
        navigationBarAppearace.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()]  // Title's text color
    
        self.window?.backgroundColor = UIColor.whiteColor()
        return true
    }
    

提交回复
热议问题