xcode segue 在简单的 segue 测试中不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8768658/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
segue does not work in simple segue test
提问by reinvdo
I have a weird problem. I have created 2 viewcontrollers in my storyboard: testSegueViewcontrollerand nextPageViewController.
The testSegueViewcontroller contains a UIButton NextPage. I Ctrl-dragged from this button to nextPageViewController and created a Push segue.
我有一个奇怪的问题。我在我的故事板中创建了 2 个视图控制器:testSegueViewcontroller和nextPageViewController。
testSegueViewcontroller 包含一个 UIButton NextPage。我从这个按钮按住 Ctrl 键拖动到 nextPageViewController 并创建了一个 Push segue。
The problem is when i run this program and clicking on the NextButton in the testSegueViewcontroller it does not show the nextPageVieController :-(
问题是当我运行这个程序并点击 testSegueViewcontroller 中的 NextButton 时,它没有显示 nextPageVieController :-(
Any ideas of what I'm doing wrong?
关于我做错了什么的任何想法?
回答by voromax
With this approach you should use modal segues. Push segue is a part of UINavigationControllertransitions
通过这种方法,您应该使用模态转场。Push segue 是UINavigationController转换的一部分
If you want to use push segue then you will need to put your testSegueViewcontrollerinto UINavigationControllerinstance. This will allow the Push segue to work.
如果你想使用 push segue,那么你需要将testSegueViewcontroller放入UINavigationController实例中。这将允许 Push segue 工作。
回答by mashios
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.
Push segue 是 navigationcontroller 的一部分,如果您的 viewcontroller 嵌入了 uinavigation 控制器,那么只有您才能将控制器推送到另一个视图。如果您不想添加导航控制器,请使用模态转换。
回答by Jakob W
You need to put the testSegueViewcontroller
inside a UINavigationController
.
你需要在testSegueViewcontroller
里面放一个UINavigationController
.