简体   繁体   中英

Can't customize UINavigationBar in with Show Detail Segue

In videDidLoad I have code that setup navigation bar in Detail view controller

UIImage *emptyImage = [UIImage new];

[self.navigationController.navigationBar setBackgroundImage:emptyImage forBarMetrics:UIBarMetricsDefault];

self.navigationController.navigationBar.shadowImage = emptyImage;    

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

This detail view will show as detail in split view controller and push to navigation stack in smaller device, so I use show detail segue in this case.

In split view controller this detail view controller show navigation bar as transparent with correct tint color, but in iPhone navigation bar not follow my setup and show as default color and style.

Do you know how to make this work. I guess its because internal process that remove navigation controller before push into navigation stack in smaller device.

Did you try this ?

UINavigationController *lc_navigationController = (UINavigationController *)self.splitViewController.viewControllers.firstObject;
lc_navigationController.navigationBar.barTintColor = [UIColor greenColor];

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