Swift UIViewController页面跳转汇总
来源:互联网 发布:人工智能 04 哈工大 编辑:程序博客网 时间:2024/04/30 14:31
swift2.x
第一种类型:NavigationViewController跳转(右侧进入)
- 跳转:
//实例化一个将要跳转的viewController let secondView = SecondViewController() //跳转 self.navigationController?.pushViewController(secondView , animated: true)
- 返回:(返回的方式有三种,下面会详细介绍)
//前提:确保当前ViewController是通过NavigationController的PushView方法跳转来的 //方式一:跳转到前一个页面 self.navigationController?.popViewControllerAnimated(true) //实例化一个ViewController let firstView = FirstViewController() //方式二:返回至指定的ViewController self.navigationController?.popToViewController(viewController: firstView , animated: true) //方式三:返回至最初的ViewController //解释:通过pushView跳转firsView->secondView->thirdView,当在thirdView执行下面语句,则调回firtView self.navigationController?.popToRootViewControllerAnimated(true)
第二种类型:ViewController跳转 (自下而上)
- 跳转(比较简单)
//实例化一个登陆界面 let loginView = LoginViewController() //从下弹出一个界面作为登陆界面,completion作为闭包,可以写一些弹出loginView时的一些操作 self.presentViewController(loginView, animated: true, completion: nil)
- 返回(比较简单)
//前提:通过 View的presentViewController跳转的页面才能执行,否则找不到上一页 //同样可以执行关闭此页时的闭包操作 self.dismissViewControllerAnimated(true, completion: nil)
更多请参考:http://www.jianshu.com/p/bad9b3823260
0 0
- Swift UIViewController页面跳转汇总
- swift navigation创建 Swift UIViewController页面跳转汇总
- ios UIViewController页面跳转
- swift页面跳转动画
- Swift学习-页面跳转
- swift 跳转页面
- Swift 页面跳转
- 页面的跳转swift
- Swift 页面跳转
- UIViewController页面跳转的两种方式
- Swift-->UIViewController的跳转,参数传递,返回参数
- swift 跳转到设置页面
- swift iphone 页面跳转-代码跳转方法
- js跳转页面方法汇总。
- Swift 登录页面跳转,条件判断 ,页面跳转
- Swift 登录页面跳转,条件判断 ,页面跳转
- Swift 登录页面跳转,条件判断 ,页面跳转
- swift页面跳转的集中方式归纳
- JAVA程序发布到Docker的fabfile
- SQL语句级别的优化总结
- SpringBoot-SpringData-ManyToMany
- 解决vs2015新建Android项目时,提示“未将对象引用设置到对象的实例”的问题
- 分析器错误消息: 未能加载文件或程序集“MySql.Web, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d”或..
- Swift UIViewController页面跳转汇总
- 面向接口编程与面向实现编程
- Caravel数据可视化平台环境搭建与使用
- springMVC中controller层调用service层的方式
- iServer性能提升介绍
- The document "(null)"requires Xcode 8.0问题的解决办法
- 商品秒杀功能思路实现
- 前端技术简介
- Leetcode 387 First Unique Character in a String