读书人

父页面连续push3个view 。怎么从Contr

发布时间: 2012-01-19 00:22:28 作者: rapoo

父页面连续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]

读书人网 >Iphone

热点推荐