OETY欧亿|Home

135-2716-3909
网站建设资讯详细

APP开发之IOS SWIFT页面跳转□□方法全解◣析

发表日期:2026-04-29 00:00:00   作者来源:OETY欧亿   浏览:9609   标签:APP开发    IOS    SWIFT    

在网站制作中,页面跳转□□使用超链□□接,A标签,非常方便▼简单,但是在IOS APP开发中就□□没那么容□□易了,需要写比□□较多的代□□码,OETY欧亿□□□以下为你□□一一分享APP页面跳转◤方法全解。

APP页面跳转

一、 使用StoryBoard点击按钮□□□直接跳转□□□□到新页面

按住Ctrl键,拖动连接线到目标页面,弹出窗口选择modal 则为新页面
如果要选择push,则原页面要实现Navigation导航

二、 利用Segue代码跳转

在起始页□□面按住Ctrl键拖动连□□□接线到目□□□□标页面,弹出窗口◎选择动作□□□□类型,然后选中□□页面连线,属性框中□□□命名Indetifier,然后中页□□面代码处□□需要跳转□□□地方使用
self.performSegueWithIdentifier ("CatSegue", sender: nil)
 

三、 代码PUSH

let mainStoryboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
        let vc = mainStoryboard.instantiateViewControllerWithIdentifier("CategoryViewController") as! CategoryViewController
 self.navigationController.pushViewController(vc, animated:true)
 

四、 代码Modal

let mainStoryboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
        let vc = mainStoryboard.instantiateViewControllerWithIdentifier("CategoryViewController") as! CategoryViewController
self.presentViewController(vc, animated: true, completion: nil)
 
如没特殊注明,文章均为OETY欧亿原创,转载请注明来自https://www.hd-banhen.com/news/2852.html