Question

My application flow: AViewController -> BViewController -> CViewController (via navigationController). AViewController and CViewController looks the same, only BViewController looks different.

I did it this way:

/// AppDelegate (should be 'super' settings)
[[UINavigationBar appearanceWhenContainedIn:[ABCNavigationController class], nil] setBackgroundImage:theImage forBarMetrics:UIBarMetricsDefault];

/// BViewController (should apply ONLY to BViewController)
[self.navigationController.navigationBar setBackgroundImage:BImage forBarMetrics:UIBarMetricsDefault];

The problem is that in CViewController i see the image i loaded in BViewController not in appDelegate. How to restore it to appDelegate settings?

I should underline that backgroundImage is one of many elements that i setup, gave it here as example.

Was it helpful?

Solution

In CViewController try setting the navbar's background image to nil in viewWillAppear, cause it reamains set by your BViewController.

[self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top