UINavigationBar set tintcolor tested in iOS7 not working?

后端 未结 6 1337
攒了一身酷
攒了一身酷 2021-02-07 01:26

I have an app which have a UINavigationBar and I have set the tint color to black like this:

self.navigationController.navigationBar.tintColor = [UI         


        
6条回答
  •  自闭症患者
    2021-02-07 02:07

    Fernando's and sanjana's answers have the key, but I'll just add something to make it clearer and more obvious.

    The navigation bar has two properties

    • tintColor
    • barTintColor

    It's a bit misleading when you don't think in iOS 7 terms.

    tintColor changes the color of the buttons on your navigation bar. To change the background color, you need to set the property barTintColor.

    self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
    self.navigationController.navigationBar.tintColor = [UIColor greenColor];
    

    This code snippet will give you a white navigation bar with green buttons.

提交回复
热议问题