前端之家收集整理的这篇文章主要介绍了
Swift 2.x UIViewController页面跳转汇总,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
第一种类型:NavigationViewController跳转(右侧进入)
- 跳转:
let secondView = SecondViewController()
self.navigationController?.pushViewController(secondView,animated: true)
- 返回:(返回的方式有三种,下面会详细介绍)
self.navigationController?.popViewControllerAnimated(true)
let firstView = FirstViewController()
self.navigationController?.popToViewController(viewController: firstView,animated: true)
self.navigationController?.popToRootViewControllerAnimated(true)
第二种类型:ViewController跳转 (自下而上)
- 跳转(比较简单)
let loginView = LoginViewController()
self.presentViewController(loginView,animated: true,completion: nil)
- 返回(比较简单)
self.dismissViewControllerAnimated(true,completion: nil)
更多请参考:http://www.jianshu.com/p/bad9b3823260