美文网首页
VC特殊转场

VC特殊转场

作者: 952625a28d0d | 来源:发表于2016-11-10 17:36 被阅读25次

    现在有三个VC A、B、C
    A要模态B,B返回的时候要导航到C,C返回的时候要Dismiss到A

    首先三个VC都没有使用系统的Nav,不具备导航功能。

    1:我们在A跳B的时候初始化一个系统的Nav,装下B和C

            nav.setViewControllers([B,C], animated: true)
            nav.navigationBar.hidden = true
            A.presentViewController(nav, animated: true, completion: nil)```
    2:在B返回的时候判断一下nav的数量,来决定跳A或者C
    ```Swift
    B.addCloseBlock { () in
                if B.navigationController?.viewControllers.count == 2{
                    B.navigationController?.popViewControllerAnimated(true)
                }else{
                    B.dismissVC(animated: true)
                }
            }```

    相关文章

      网友评论

          本文标题:VC特殊转场

          本文链接:https://www.haomeiwen.com/subject/prexpttx.html