Change color of Back button in navigation bar

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

    If you already have the back button in your "Settings" view controller and you want to change the back button color on the "Payment Information" view controller to something else, you can do it inside "Settings" view controller's prepare for segue like this:

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 
        if segue.identifier == "YourPaymentInformationSegue"
        {
            //Make the back button for "Payment Information" gray:
            self.navigationItem.backBarButtonItem?.tintColor = UIColor.gray               
        }
    }
    

提交回复
热议问题