简体   繁体   English

performSegueWithIdentifier无效

[英]performSegueWithIdentifier isn't working

I have this code running when I tap a button: 点击按钮时,我运行了此代码:

[self performSegueWithIdentifier:@"services" sender:self];
NSLog(@"ButtonClicked");

I can see the log message appearing each time I press the button but the segue isn't activating . 每次按下按钮但是segue没有激活时,我都可以看到日志消息出现。

In my storyboard file I have a segue named services , that's the segue I want to activate. 在我的故事板文件中,我有一个名为服务的segue,这就是我要激活的segue。

Any idea where I'm going wrong? 知道我哪里错了吗?


Edit The button is inside a tab bar controller, will that affect things? 编辑按钮位于标签栏控制器内,会影响到什么吗?

For push you need to embed your source view controller in navigation controller.You can do this as follows: 对于推送,您需要将源视图控制器嵌入导航控制器中。您可以按如下方式执行此操作:

Select your source view controller, Go to Editor and select Embed In -> Navigation Controller. 选择源视图控制器,转到编辑器并选择嵌入 - >导航控制器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM