ios - segue adds a navigation to the view -
i have added navigationbar
view2 "back" item , ctrl-dragged item view1 add segue
(a show
segue). whenever "back" used navigate view1, navigation bar (with item "back") view (view1). want navigation bar view2, not view1. can hide view1's navigationbar
programmatically wondering if doing wrong.
you need hide navigation bar view1 inside viewwillappear , unhide while going viewwilldisappear:
view1:
- (void)viewwillappear:(bool)animated { [super viewwillappear:animated]; [self.navigationcontroller.navigationbar sethidden:true]; } - (void)viewwilldisappear:(bool)animated { [super viewwilldisappear:animated]; [self.navigationcontroller.navigationbar sethidden:false]; }
view2:
- (void)viewwillappear:(bool)animated { [super viewwillappear:animated]; [self.navigationcontroller.navigationbar sethidden:false]; } - (void)viewwilldisappear:(bool)animated { [super viewwilldisappear:animated]; [self.navigationcontroller.navigationbar sethidden:true]; }
any 1 of class function can use, either view1 functions or view2 functions hide , unhide navigation bar while switching controller.
Comments
Post a Comment