Swif页面跳转

push与present都可以推出新的界面。
present与dismiss对应,push和pop对应。
present只能逐级返回,push所有视图由视图栈控制,可以返回上一级,也可以返回到根vc,其他vc。
present一般用于不同业务界面的切换,push一般用于同一业务不同界面之间的切换。

//push方式

self.navigationController.pushViewController(vc, animated:true)

//present方式

self.presentViewController(vc, animated: true, completion: nil)

//显示列表

let sb = UIStoryboard(name:"Main", bundle: nil)
let listController = sb.instantiateViewControllerWithIdentifier("demoList") as! DemoListViewController
self.presentViewController(listController, animated: true, completion: nil)
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容