iOS presentedViewController和presentingViewController的区别

当我们用present进行界面跳转时,会涉及到一个传向关系。

比如:A -> B    界面A跳转界面B

A.presentedViewControlle = B

B.presentingViewController = A

这就是两者间的关系。

所以有以下使用场景:

当界面B又跳转了界面C,在C关闭的时候,我们也想关闭B,可以这样:

  let B = self.presentingViewController        
  self.dismiss(animated: true) {
       B?.dismiss(animated: true, completion: nil)
  }
原文地址:https://www.cnblogs.com/yajunLi/p/6861302.html