The navigation bar jumps the page the consideration for to use the Navigationcontroller to jump the page, actually is carries on the stack and the stack operation, wants to release the memory, then when jumps back and forth, must consider several questions
1 A =>b=>c=>d,
D=>a with root view (HOME)
[Self.navigationcontroller Poptorootviewcontrolleranimated:yes];
D=>C (Each interface returns to the previous layer)
[Self.navigationcontroller Popviewcontrolleranimated:yes];
Return to the previous layer, and pass parameters
Cviewcontroller *CVC = [Cviewcontroller alloc]init];
Cvc.str = Self.str;
[Self.navigationcontroller POPTOVIEWCONTROLLER:CVC animated:true];
After returning to the previous layer, the previous page is displayed after the parameter is received and refreshed. Note that this should be judged in viewdidappear and receive the passed value
-(void) Viewdidappear: (BOOL) animated
{
Determine and receive the returned parameters
}
2 A =>b=>c=>d=>e,e=>b=>c=>ebecause B has already appeared before, can not be directly push to B in E, because that is already two B, increase memory, so in the jump, it is necessary to judge whether there has been a B before, appeared, then direct push. This push to the original B, does not regenerate a B in memory.
Nsarray *array = self.navigationController.viewControllers;
For (Uiviewcontroller *VC in array) {
if ([VC Iskindofclass:[bxxxviewcontroller Class]]) {
Push VC;
}
or know the pointers to each interface.
[Self.navigationcontroller
Poptoviewcontroller: [Self.navigationController.viewControllers
Objectatindex: ([self.navigationController.viewControllers Count]-4)]
Animated:yes];
In use, according to the needs of their own return layer, as long as a change of "4" this number can achieve the goal
Related jumps returned from the IOS navigation bar