在網(wǎng)站制作中,頁(yè)面跳轉(zhuǎn)使用超鏈接,A標(biāo)簽,非常方便簡(jiǎn)單,但是在IOSAPP開(kāi)發(fā)中就沒(méi)那么容易了,需要寫比較多的代碼,中企動(dòng)力以下為你一一分享APP頁(yè)面跳轉(zhuǎn)方法全解。
一、使用StoryBoard點(diǎn)擊按鈕直接跳轉(zhuǎn)到新頁(yè)面?按住Ctrl鍵,拖動(dòng)連接線到目標(biāo)頁(yè)面,彈出窗口選擇modal則為新頁(yè)面
如果要選擇push,則原頁(yè)面要實(shí)現(xiàn)Navigation導(dǎo)航
二、利用Segue代碼跳轉(zhuǎn)在起始頁(yè)面按住Ctrl鍵拖動(dòng)連接線到目標(biāo)頁(yè)面,彈出窗口選擇動(dòng)作類型,然后選中頁(yè)面連線,屬性框中命名Indetifier,然后中頁(yè)面代碼處需要跳轉(zhuǎn)地方使用
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)