ios - How to pop to previous scene? -
i created 2 scenes in storyboard , 1 xib file.i have put 2 buttons in xib file( button1 go first scene , button2 go 2nd scene).from first scene if move second scene , there third scene(xib file) , if click on button1,it navigates properly(i.e.,to first scene) , if click on button2,it comes second scene.it works properly.but instead first scene if move directly third scene(xib file) , if click button2,it comes first scene only.but wanted come second scene.button1 works properly,but not button2.so can me out in this?i want button2 work said.
my code is:
@implementation xyzgreenviewcontroller -(ibaction)goredscreen:(id)sender { [self.navigationcontroller poptorootviewcontrolleranimated:true]; } -(ibaction)gobluescreen:(id)sender { [self.navigationcontroller popviewcontrolleranimated:yes]; }
think of uinavigationcontroller stack, every time navigate new scene/viewcontroller, pushing new view controller stack.
in first scenario, have following in stacks once arrived @ third scene
[first scene | second scene | third scene]
if press on of button matter, pop out third scene , go second scene.
in second case, went directly first scene third scene have following in stack
[first scene | third scene]
obviously, if popout viewcontroller first scene because second scene never on stack. however, can push stack using pushviewcontroller:
Comments
Post a Comment