swift页面跳转的集中方式归纳

swift页面跳转的集中方式归纳,第1张

概述1.选择属性栏的第三项 2.在Identifyt选项中填写 "storyboard ID"为post。这个ID根据自已的情况填写,后面的代码中会用到 3.重点来了,为登录按钮添加页面跳转代码 @IBAction func LoginButtonLicked(sender: AnyObject){ let myStoryBoard = self.storyboard let anotherView: 1.选择属性栏的第三项 2.在IDentifyt选项中填写 "storyboard ID"为post。这个ID根据自已的情况填写,后面的代码中会用到 3.重点来了,为登录按钮添加页面跳转代码 @IBAction func Loginbuttonlicked(sender: AnyObject){ let myStoryBoard = self.storyboard let anotherVIEw:UIVIEwControl = myStoryBoard.instanceVIEwControllerWithIDentifIEr("post") as UIVIEwControl self.presentVIEwController(anotherVIEw,animated: true,completion: nil) } //和上面同一种方式,实现方法不同,上次使用时上面一种方式好像不能用了,可以选择1,2来选用 //显示列表 // let sb = UIStoryboard(name:"Main",bundle: nil) // let ListController = sb.instantiateVIEwControllerWithIDentifIEr("demoList") as! DemoListVIEwController // self.presentVIEwController(ListController,completion: nil) //////push方式 self.navigationController.pushVIEwController(vc,animated:true) //返回是pop //////present方式 self.presentVIEwController(vc,completion: nil) //返回改变vc为前一个 //////segue方式 拖线,然后重写方法prepareForSegue overrIDe func prepareForSegue(segue: UIStoryboardSegue,sender: AnyObject!) { if segue.IDentifIEr == "GoTogallery" { let index = beautyPicker.selectedRowInComponent(0) var vc = segue.destinationVIEwController as! galleryVIEwController vc.imagename = "fanbingbing" } } /////返回方式 在前一个页面中重写一个方法,拖线到exit中后选择这个方法 @IBAction func close(segue: UIStoryboardSegue) { print("closed!") } ///////////////////////////最后说一句,传值都是得到要跳转的页面,然后为这个页面的controller的属性赋值,然后在后一个页面就可以得到值 总结

以上是内存溢出为你收集整理的swift页面跳转的集中方式归纳全部内容,希望文章能够帮你解决swift页面跳转的集中方式归纳所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1082208.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存