简体   繁体   中英

change the navigationbar backgroundcolor for a tabbarcontroller

My UI is just from TabBarController A to TabBarController B, those two TabBarController with different child items. Now I want to change the TabBarController B's navigationbar backgroundColor, but any of those methods followed are not work.

tabBarViewControllerA.navigationController.navigationBar.backgroundColor = [UIColor yellowColor]; babBarViewControllerB.navigationController.navigationBar.backgroundColor = [UIColor yellowColor]; babBarViewControllerB.childViewControllers.firstObject.navigationController.navigationBar.backgroundColor = [UIColor yellowColor];

Also, from the debug->view debugging->capture view hierarchy, I can see the navigationbar backgroundcolor has changed, but the finial color is not changes. Please give me some ideas about the problem.

发现只需要更改navigationbar.bartintcolor

试试这个。

 self.navigationController.navigationBar.barTintColor = [UIColor orangeColor];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM