在網站制作中,頁面跳轉使用超鏈接,A標簽,非常方便簡單,但是在IOSAPP開發中就沒那么容易了,需要寫比較多的代碼,中企動力以下為你一一分享APP頁面跳轉方法全解。
一、使用StoryBoard點擊按鈕直接跳轉到新頁面?按住Ctrl鍵,拖動連接線到目標頁面,彈出窗口選擇modal則為新頁面
如果要選擇push,則原頁面要實現Navigation導航
二、利用Segue代碼跳轉在起始頁面按住Ctrl鍵拖動連接線到目標頁面,彈出窗口選擇動作類型,然后選中頁面連線,屬性框中命名Indetifier,然后中頁面代碼處需要跳轉地方使用
self.performSegueWithIdentifier(CatSegue,sender:nil)
三、代碼PUSHletmainStoryboard=UIStoryboard(name:Main,bundle:NSBundle.mainBundle())
etvc=mainStoryboard.instantiateViewControllerWithIdentifier(CategoryViewController)as!CategoryViewControllerself.navigationController.pushViewController(vc,animated:true)
四、代碼ModalletmainStoryboard=UIStoryboard(name:Main,bundle:NSBundle.mainBundle())
etvc=mainStoryboard.instantiateViewControllerWithIdentifier(CategoryViewController)as!CategoryViewControllerself.presentViewController(vc,animated:true,completion:nil)