Search code examples
objective-ciosuinavigationcontrolleruinavigationbaruiappearance

How can I access my UINavigationBar properties with this config?


My main view controller is embedded in a UINavigationController. On my main view I've a button heading to another View Controller, let's call it "settingsController".

The problem is that I changed my UINavigationBar's appearance in my NavigationController (with UIAppearance or subclassing UINavigationBar, nevermind). But I don't want a custom NavigationBar in my settingsController, where I've no NavigationBar attribute in IB. So how can I change this ?

Thanks for your advices

EDIT : quickly, to sum up this :

enter image description here


Solution

  • In any view controller, you can call self.navigationController.navigationBar to get the navigation bar of the navigation controller you're currently inside.

    You could try changing the appearance in viewWillAppear on your settings view controller, and putting it back again in viewWillDisappear.