在網站制作中,頁面跳轉使用超鏈接,A標簽,非常方便簡單,但是在IOS 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)