如何像系统iOS的设置一样进行视图转换?

How to do view transition like setting of system iOS?

我有一个问题,我对此一无所知...

我想更改界面如设置:settings.gif

我连关键字都不知道去网上搜...

我使用了 "interactive transition" 和 "gesture interactive" 等...但是我找不到正确的答案或演示或代码...

你能告诉我如何编写代码来更改界面,例如系统设置 iOS(也许是教程...)?非常感谢!

PS : 我通过 uiviewcontroller 创建了两个视图,而不是 uinavigationController

叫做interactivePopGestureRecognizer

self.navigationController?.interactivePopGestureRecognizer?.delegate = self self.navigationController?.interactivePopGestureRecognizer?.enabled = true

将这些行放入您的 ViewController class 并将 UIGestureRecognizerDelegate 添加到您的 class

class ViewControllerClass : UIViewController, UIGestureRecognizerDelegate {
// class methods
}

您还可以实现委托方法

func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool {
    return true
}

func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailByGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool {
    return (gestureRecognizer is UIScreenEdgePanGestureRecognizer)
}

我已经资助了我的答案,我把它放在那里,因为我认为这可能会对其他初学者有所帮助。

1) 我嵌入了视图的导航栏。

2)在1)之后,我们可以使用

let secondViewController = self.storyboard!.instantiateViewControllerWithIdentifier("Your view") as! LoginViewController

        self.navigationController!.pushViewController(secondViewController, animated: true)

3) seconde view中会有一个backbitten automatic,我们可以像系统设置一样iOS