objective-c - IOS 模态视图能实现Push到其他页面的功能吗?
天蓬老师
天蓬老师 2017-04-17 12:58:31
[iOS讨论组]

流程:A->B->模态C->D->F
之前栈中都是一个个push过来的,现在业务需求需要弹出模态视图C,然后点击模态视图中的按钮push到其他页面,本人之前的想法是把模态C当作新的栈

QkMatchDocViewController *viewController = [[QkMatchDocViewController alloc] initWithNibName:@"QkMatchDocViewController" bundle:nil];

viewController.userInfo = content;

UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:viewController];

[self presentModalViewController:navi animated:YES];

这样就能push过去,同时新的问题来了:
[self.navigationController popToRootViewControllerAnimated:YES];
回首页就会回答模态视图C,正确的流程是pop到A视图,我想先关闭模态,在用通知的机制去B视图pop,但是后来因为考虑到业务流程,觉得这个方法不可行。

请问各位大神,指点下其他的方法。

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

全部回复(2)
ringa_lee

关闭模态视图

[self dismissModalViewControllerAnimated:YES];

获取当前的nav栈中viewcontroller,调用

((UINavigationController *)_window.rootViewController).visibleViewController
    or
((UINavigationController *)_window.rootViewController).topViewController

push到你要到的视图去

天蓬老师

我觉得你的流程有问题,正确的流程是:<从模态视图push时,先关闭模态,然后在原先navigation的流程下push>。而不是在模态上push,因为模态本身就是开辟了一个新的navigation。如果你要push的东西走原来的navigation流程,那就按照我说的做。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号