http://www.jianshu.com/p/bad9b3823260
学习目标:
学会最基础的两种页面跳转的方式在正确的场景应用正确的方式
效果图
第一种类型:NavigationViewController跳转(右侧进入)
跳转:
swift
let secondView =
SecondViewController()
self.navigationController?.pushViewController(secondView , animated:
true)
返回:(返回的方式有三种,下面会详细介绍)
swift
self.navigationController?.popViewControllerAnimated(
true)
let firstView =
FirstViewController()
self.navigationController?.popToViewController(viewController: firstView , animated:
true)
self.navigationController?.popToRootViewControllerAnimated(
true)
第二种类型:ViewController跳转 (自下而上)
跳转(比较简单)
swift
let loginView =
LoginViewController()
self.presentViewController(loginView, animated:
true, completion:
nil)
返回(比较简单)
swift
self.dismissViewControllerAnimated(
true, completion:
nil)
总结:这就是两种不同类型的跳转,各自应用在不同的场景下
Navigation跳转场景:有逻辑层级关系的跳转,如下图(带有明显的主线关系)
navigation跳转
View的PresentViewController跳转:则是突发性的、临时性的以及独立性的 模拟场景:用户点击退出登录按钮,清除用户个人信息,通过presentViewController的方式跳转到登陆界面,当用户登陆,在返回过去即可 之前做过的小项目情景
View跳转
文/zZ爱吃菜(简书作者)
原文链接:http://www.jianshu.com/p/bad9b3823260
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。
转载请注明原文地址: https://ju.6miu.com/read-1296682.html