ios - 嵌套presentViewController后,如何直接返回到最开始的那个viewcontroller?
PHP中文网
PHP中文网 2017-04-17 15:31:25
[iOS讨论组]

3个viewcontroller: A, B, C

[A presentViewController: B animated: YES]
[B presentViewController: C animated: YES]

在C中如何直接返回到A,当前我得做法:
[c.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:nil];
模拟器上测试,可以直接返回到A,但还是能够看到C返回到B, B再返回到A,只不过B停留在屏幕的时间非常的短。

我尝试过, [c.presentingViewController.presentingViewController dismissViewControllerAnimated:NO completion:nil];
会有闪的突兀感。觉得不好。

有什么方法,可以避免出现以上这种情况,使用户感觉不到B曾经出现过,同时也不会让用户感觉到屏幕顿闪的突兀感?

PHP中文网
PHP中文网

认证高级PHP讲师

全部回复(2)
伊谢尔伦

presentingViewController连续嵌套不会觉得很奇怪?
我都是用navigation然后push,回到第一个只需要用self.navigationController popToRootViewControllerAnimated:
或者试试[[[[[self parentViewController] parentViewController] parentViewController] parentViewController] dismissModalViewControllerAnimated:YES];

阿神

请问你是怎么解决的呢?我现在也遇到了这个问题

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

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