ios - UINavigationBar custom background image applied in one view controller and then affecting every single view controller in the app -


i working themes in app. each theme comes custom navigation bar. default, have applied custom navigation bar in appdelegate:

[uiapplication sharedapplication].statusbarstyle = uistatusbarstylelightcontent; uiimage *navbackgroundimage = [uiimage imagenamed:@"purplynav.png"]; [[uinavigationbar appearance] setbackgroundimage:navbackgroundimage forbarmetrics:uibarmetricsdefault]; 

if go specific table view controller in app , in viewwillappear, put:

if ([self.selectedtheme isequaltostring:@"blur"]) {     uiimage *navbackgroundimage = [uiimage imagenamed:@"pastelpinknav.png"];     [[uinavigationbar appearance] setbackgroundimage:navbackgroundimage forbarmetrics:uibarmetricsdefault]; } 

the "pastelpinknav" gets applied every single navigation bar in app, though i'm setting in 1 table view controller.

how set navigation bar applies 1 view controller when set, still set default in app delegate when theme not set?

thanks in advance!

you have change again navigationbar image in viewwilldisappear

uiimage *navbackgroundimage = [uiimage imagenamed:@"purplynav.png"]; [[uinavigationbar appearance] setbackgroundimage:navbackgroundimage forbarmetrics:uibarmetricsdefault]; 

because using [uinavigationbar appearance] commonly changes uinavigationbar appearance.


Comments

Popular posts from this blog

android - Inheriting from Theme.AppCompat* -

broadcastreceiver - android BOOT_COMPLETED not received if not activity intent-filter -

basic authentication with http post params android -