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)
  }

 

posted @ 2017-05-16 14:42  那一抹风情  阅读(1064)  评论(0编辑  收藏  举报