当前位置: 代码迷 >> Iphone >> 父页面连续push3个view 。怎么从ControlView3 返回父页面并刷新父页面
  详细解决方案

父页面连续push3个view 。怎么从ControlView3 返回父页面并刷新父页面

热度:121   发布时间:2016-04-25 06:50:33.0
父页面连续push3个view 。如何从ControlView3 返回父页面并刷新父页面?
[self.navigationController pushViewController:ControlView1 animated:YES];

[self.navigationController pushViewController:ControlView2 animated:YES];


[self.navigationController pushViewController:ControlView3 animated:YES];

父页面连续push3个view 。如何从ControlView3 返回父页面? 把ControlView1 ControlView2 ControlView3 都pop出去。然后调用父页面的一个方法,刷新父页面

------解决方案--------------------
用到委托。你可以在ControlView3里定义一个委托。从ControlView3里退出的地方调用这个委托。

ControlView3的委托在父页面实现。实现的内容就是:

[self.navigationController popViewControlleranimated:YES];

[self.navigationController popViewControlleranimated:YES];


[self.navigationController popViewControlleranimated:YES];
------解决方案--------------------
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:你父页面的位置,我感觉你可以填0] animated:YES];

如果你说的父页面是根基视图的话也可以这样:

[self.navigationController popToRootViewControllerAnimated:YES]
------解决方案--------------------
[self.navigationController popToRootViewControllerAnimated:YES]
  相关解决方案