ios - Different navigation bar style in different controllers? -


i've got question setting different styles of navigationbar in different uiviewcontrollers. i've got 4 different controllers , want last 1 totally transparent white navigationitems , other 1 white black navigationitems.

is there quick , easy solution this? thinking setting style each view in appdelegate

what need save navigation bar tintcolor , bartintcolor before view appears , change whatever need. when view disappears, restore previous ones.

@interface myviewcontroller ()  @property (strong, nonatomic) uicolor *navigationbartintcolor; @property (strong, nonatomic) uicolor *navigationtintcolor;  @end  @implementation myviewcontroller  - (void)viewwillappear:(bool)animated {     [super viewwillappear:animated];      // save current colors     self.navigationbartintcolor = self.navigationcontroller.navigationbar.bartintcolor; // background color     self.navigationtintcolor = self.navigationcontroller.navigationbar.tintcolor; // items color       self.navigationcontroller.navigationbar.tintcolor = [uicolor whitecolor];     self.navigationcontroller.navigationbar.bartintcolor = [uicolor clearcolor];     [self.navigationcontroller.navigationbar setbackgroundimage:[uiimage new] forbarmetrics:uibarmetricsdefault];     self.navigationcontroller.navigationbar.shadowimage = [uiimage new]; }  - (void)viewwilldisappear:(bool)animated {     [super viewwilldisappear:animated];      // previous colors , set them     self.navigationcontroller.navigationbar.bartintcolor = self.navigationbartintcolor;     self.navigationcontroller.navigationbar.tintcolor = self.navigationtintcolor;     [self.navigationcontroller.navigationbar setbackgroundimage:nil forbarmetrics:uibarmetricsdefault]; } 

edit: use code in view controller needs have transparent navigation bar.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -