• Swfit中视图跳转


    1.跳转到任一UIViewController
    
      var sb = UIStoryboard(name: "Main", bundle:nil)
      var vc = sb.instantiateViewControllerWithIdentifier("ChooseViewController") as ChooseViewController
      self.presentViewController(vc, animated:true, completion:nil)
    
    2.从当前视图跳转到下一视图
    
      var vc = AnswerViewController()
      self.presentViewController(vc, animated: true, completion: nil)
    
    3.通过dismissViewControllerAnimated(completion:)返回上一个视图
    
      self.dismissViewControllerAnimated(true, completion:nil)
    
    4.Modal Segue to channel Controller
    通过在storyboard设计视图中,选择一个按钮,右键拖动到另一个视图,即可建立动作跳转,但需要重载func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!)方法,如下:
    
      override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
          var channelC:ChannelController=segue.destinationViewController as ChannelController
          channelC.delegate=self
          channelC.channelData=self.channelData
      }
    
    5.通过navigationController.pushViewController(animated:)方法
    
      var webView=WebViewController()
      webView.detailID=data.newsID
      //取导航控制器,添加subView 
    self.navigationController.pushViewController(webView,animated:true)
    6.通过 func popViewControllerAnimated() -> UIViewController! 弹出最上面的视图,并返回下一个视图控制器 7.通过func popToViewController(animated:) -> AnyObject[]!返回到navigationController视图堆栈中指定的某一个视图
  • 相关阅读:
    cent os 6.8 php 5.6 安装ffmpeg扩展
    Linux查找目录下文件包含关键字
    python生成随机验证码
    zabbix添加任务计划和sshd文件修改key
    OS模块
    python模块
    python内建函数
    python3 爬煎蛋ooxx妹子图
    ssm整合-Sping整合Mybatis框架配置事务07
    ssm整合-Sping整合Mybatis框架06
  • 原文地址:https://www.cnblogs.com/Free-Thinker/p/5006305.html
Copyright © 2020-2023  润新知