ios - presentViewController和pushViewController跳转页面之后,如何回到最初的页面?
黄舟
黄舟 2017-04-17 17:10:06
0
3
612

A页面跳到B页面。用模态切换presentViewController的方式跳转

UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:VC];
    [self presentViewController:nav animated:YES completion:nil];

这样跳到了B页面。B又跳到了C页面。C又跳到D页面。

用导航控制器入栈的方式切换,代码如下:

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

现在问题来了。我要从D页面。直接回到A页面。应该怎么回?


好像这样解决了

[((UIViewController*)weakSelf.navigationController.viewControllers[0]) dismissViewControllerAnimated:YES completion:^{
                    [[NSNotificationCenter defaultCenter] postNotificationName:NotificationLoginCallBack object:nil];
                }];

只是还不算完美。首先切到了B页面,然后B消失,回到了A页面。
如果能从D直接动画切到A。不经过B页面,更完美。不过目前算可用了
希望有更完美的方案

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

全部回复(3)
黄舟

昨天没时间就占位随便答了一下,今天我测试了一下后,结论是:

直接调用 self.navigationController 的 dismissViewControllerAnimated 方法。
动画效果就是直接的向下推出。

迷茫

for (UIViewController *temp in self.navigationController.viewControllers) {

雷雷
洪涛

博主,我也在做这样的功能。请问你最后解决了这问题吗

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!