如何dismiss多个viewController(当然是建立在已经连续present多个controller的前提下)

今天才真正认识dismissViewControllerAnimated这个方法:

举个例子:

A->B->C->D (->代表present,当前页面是D)

如果想回到B

用[B dismissViewControllerAnimated:YES completion:nil]

这样调用,只会最上面的D会以动画的方式消失,其他中间的C从堆栈中删除,达到回到B的效果。

如何在D获取到B?
D的presentingViewController是C,C的presentingViewController是B,
所以
在D页面的时候
C= D.presentingViewController;
B = C.presentingViewController;

UIViewController *parentVC = self.presentingViewController;

再举个例子A->B

dismissViewControllerAnimated 其实是prespresenting view controller(A)用这个方法来dissmiss B的,而我们平时经常在B页面使用用[self dismissViewControllerAnimated:YES completion:nil];(self是B),其实UIKit会要求A处理这个dismiss。

原文:

The presenting view controller is responsible for dismissing the view controller it presented. If you call this method on the presented view controller itself, UIKit asks the presenting view controller to handle the dismissal.

If you present several view controllers in succession, thus building a stack of presented view controllers, calling this method on a view controller lower in the stack dismisses its immediate child view controller and all view controllers above that child on the stack. When this happens, only the top-most view is dismissed in an animated fashion; any intermediate view controllers are simply removed from the stack. The top-most view is dismissed using its modal transition style, which may differ from the styles used by other view controllers lower in the stack.

如何dismiss多个viewController相关推荐

  1. dismiss 多个viewController

    控制器堆栈是dismiss掉下面的,上面的自动就dismiss. [self.presentingViewController.presentingViewController dismissView ...

  2. present/push的恩怨情仇

    present/push的恩怨情仇 push/pop 简介 VC栈存储 container view controller 优势 dealloc navigationController 无navig ...

  3. dismiss ios pop效果_iOS ~ ViewController的Push,Pop和Present,Dismiss转场动画

    转场动画涉及到的包括导航控制器的Push动画和Pop动画,以及普通控制器的Present和Dismiss动画,主要就是通过控制器遵守UIViewControllerTransitioningDeleg ...

  4. 连续 dismiss (模态取消) 两个或者多个viewController

    做项目是遇到一个场景:VC presentViewController(模态弹出)到VC1:VC1 又 presentViewController 到VC2 :此时,想从VC2 直接dismiss 到 ...

  5. Present ViewController详解

    阅读:15112014-04-29 13:58 标签:弹出窗popwindowit 参考:http://www.cnblogs.com/linyawen/archive/2012/06/09/2542 ...

  6. 【iOS】iOS之Button segue弹出popOver消除(dismiss)问题

    如图.由于程序须要,点击Button Ctrl+Dragging加入了一个UITableViewController,当然其余的Controller也能够,这样我们在方法 -(void)prepare ...

  7. iOS开发--下滑返回dismiss

    简介 现在越来越多的应用有看大图或者进入详情页面,但是,再返回的时候,普通意义上,会点击左上角的返回,这时候你就会发现,还需要将手指移动到左上角,这样,无意给用户增添了麻烦,并且,现在手机屏幕越来越大 ...

  8. 如何在不同的 ViewController 之间传递信息

    ViewController 之间传递信息 iOS 开发中,不同的 ViewController 之间传递信息的方式有好几种.这里介绍常见的三种方式,使用自带的 prepare 方式.使用委托模式.使 ...

  9. dismiss ios pop效果_iOS实现pop效果(模态一个气泡出来)

    前面写过一篇关于UIPopoverPresentationController简单实用的文章,在使用中可能会碰到一个问题,就是点击pop出来的界面之外的地方pop出的界面才会消失,这就导致如果我在po ...

  10. ViewController转场动画的切换

    关于转场动画的切换这方便一直想研究好久了,但是奈何都下不了决心, http://blog.csdn.net/hmt20130412/article/details/39079905 这篇博客对于转场动 ...

最新文章

  1. 手把手带你打造一款 签名设计 的GUI图形界面!
  2. Support:Tenjeafan@163.com
  3. PHP识别电脑还是手机访问网站
  4. 小程序 实名信息_【小程序】实名认证流程
  5. 开源配置管理平台-Apollo
  6. python timestamp转string_Python仿真区块链【含源码】
  7. matlab 色彩模型,常见色彩模型的相互转换(基于MATLAB).doc
  8. [html] 说说你对<meta>标签的理解
  9. stl vector 函数_vector :: clear()函数,以及C ++ STL中的示例
  10. 如何修复Mac清倒废纸篓提示“操作无法完成,因为该项目正在使用中”
  11. 微信小程序 - 为何setData到页面上有的加分号
  12. 用Dell光盘安装系统
  13. ios Undefined symbols for architecture arm64
  14. how to remove untagged / none images
  15. client_loop: send disconnect: Broken pipe_欧姆龙plc之间用 SEND 和 RCV 指令发送读取数据...
  16. Oracle 使用 PL/SQL Developer 生成 AWR 报告
  17. ssm留学生交流互动论坛网站计算机毕业设计
  18. rtl驱动 ubuntu 禁用_Ubuntu如何安装rtl8822be驱动
  19. 中华名将索引 - 第一批:白起
  20. 小程序中 icon 颜色自定义解决方案

热门文章

  1. 【pyqt5学习】——添加菜单栏动作action,给动作触发triggered绑定事件
  2. free top 内存泄漏 内存溢出
  3. elasticsearch之analysis
  4. Stealing packets
  5. Latex bare_jrnl模板报错:something‘s wrong--perhaps a missing\item. \end{thebibliography}
  6. VUE使用echarts实现中国地图航线动态展示
  7. 防止backspace键后退网页
  8. matlab把句子分割成单词_将英语句子单个单词分割存储
  9. Consider defining a bean of type ‘com.xingchen.media.service.MediaFileService‘ in your configuration
  10. Cropper使用(图片裁切)