segue does not work in simple segue test

匿名 (未验证) 提交于 2019-12-03 02:23:02

问题:

I have a weird problem. I have created 2 viewcontrollers in my storyboard: testSegueViewcontroller and nextPageViewController.
The testSegueViewcontroller contains a UIButton NextPage. I Ctrl-dragged from this button to nextPageViewController and created a Push segue.

The problem is when i run this program and clicking on the NextButton in the testSegueViewcontroller it does not show the nextPageVieController :-(

Any ideas of what I'm doing wrong?

回答1:

With this approach you should use modal segues. Push segue is a part of UINavigationController transitions

If you want to use push segue then you will need to put your testSegueViewcontroller into UINavigationController instance. This will allow the Push segue to work.



回答2:

Push segue is a part of navigationcontroller if your viewcontroller is embed with uinavigation controller then only you will able to push the controller to another view. If you don't want to add navigation controller then use modal transitions.



回答3:

You need to put the testSegueViewcontroller inside a UINavigationController.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!