objective c - iOS navigate from inital view to second view from the last view -
below see view hierarchy. view green color last view. last view want show view, indicated black arrow.
however when user wants navigate view, initial view (indicated yellow arrow) should presented. make segue last view "black arrow" view. how can show initial view (yellow arrow) when user goes back?
method1: well, depends on segues, if of them push type, green vc embedded too. if is, can navigate through hierarchy via [self.navigationcontroller poptoviewcontroller:desiredviewcontroller animated:yes]
.
here method does: pops view controllers until specified view controller @ top of navigation stack.
reference: uinavigationcontroller class
method2: if still want use modal presentation, create weak delegate
property bind greencontroller controller, presented (or use nsnotificationcenter listen dismiss modal view controller event). once user pressed on dismissing, controller presented greencontroller redirects no animation yellow one. create illusion once dismissed controller underneath yellowcontroller. however, still depends on transition needs between yellow-green controllers.
Comments
Post a Comment