Is there any way to have different barTintColor
of UINavigationController
\'s UINavigationBar
on different pushed controllers w
You can get this by using UIViewControllerTransitionCoordinator
.
AController
and customize the colors.BController
and customize the colors.UINavigationController
's push/pop transition, the AController
's style will smoothly fade in/out to BController
's style.Example code:
-(void) viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[[self transitionCoordinator] animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
self.navigationController.navigationBar.translucent = NO;
self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
// text color
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
// navigation items and bar button items color
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
// background color
self.navigationController.navigationBar.barTintColor = [UIColor blueColor];
} completion:nil];
}