Search code examples
objective-ciosuinavigationbarappearance

Use barStyles after setBackgroundImage in UINavigationBar


I'm am trying to use the UIBarStyleBlackTranslucent after styling my UINavigationBar with setBackgroundImage:forBarMetrics.

The problem here is, its now always styled and when i set the barStyle nothing really happens.


Solution

  • I think you will have to set your custom appearance individually for each navigation bar inside your viewcontroller's viewDidLoad rather than using the class proxy:

    [self.navigationController.navigationBar setBackgroundImage...
    

    This sounds tedious in the extreme. I'm away from my mac at the moment but it might be possible to keep your existing code and use the above method to set the background image to nil just for the gallery?