Ios 从另一个UIStoryboard打开UIStoryboard

Ios 从另一个UIStoryboard打开UIStoryboard,ios,uistoryboard,Ios,Uistoryboard,我无法从第二个UIStoryboard调用一个UIStoryboard。我的第一个故事板-主,第二个-管理。单击UIButton时,不会发生任何操作。我的源代码: UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Management" bundle:[NSBundle mainBundle]]; UIViewController *yourViewController = [storyboard instantiateV

我无法从第二个UIStoryboard调用一个UIStoryboard。我的第一个故事板-主,第二个-管理。单击UIButton时,不会发生任何操作。我的源代码:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Management" bundle:[NSBundle mainBundle]];
UIViewController *yourViewController = [storyboard instantiateViewControllerWithIdentifier:@"Management"];
[self.navigationController pushViewController:yourViewController animated:YES];

这里可能有很多原因。 1.您可能忘记将iAction outlet设置到UIButton 2.情节提要名称可能与您在代码中指定的名称不匹配 3.[情节提要实例化eviewController标识符:@Management];是否确实为此控制器指定了相同的情节提要ID?
4.为了检查所有这些建议,只需在代码的第一行设置断点并尝试重现这种情况就足够了。

在该代码中可能会发生许多错误的事情

首先,确保您的操作连接良好,在您的操作中放置一个断点以查看是否正在调用该断点

其次,确保序列图像板名称正确,在序列图像板之后放置一个断点,并在调试控制台中检查它是否为nil po序列图像板

其次,确保Management.storyboard有一个带有标识符管理的ViewController。因此,在调试器控制台中的ViewController之后放置一个断点,以检查它是否为nil po yourViewController


最后,确保操作所在的视图控制器位于导航控制器内。因此,检查self.navigationController是否为nil po self.navigationController,在您停止操作的代码后,调试器控制台中的self.navigationController需要用此替换旧代码

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Management" bundle:[NSBundle mainBundle]];
                                            UIViewController *yourViewController = [storyboard instantiateViewControllerWithIdentifier:@"ManagementIDS"];
                                            [self presentViewController:yourViewController animated:YES completion:nil];

如果您更喜欢在interface builder中而不是在代码中执行此操作:

现在可以在interface builder中创建情节提要引用。这意味着您可以从另一个故事板链接一个故事板。目标必须是ios9

检查19:00

您尝试过使用segue吗?可能没有。你能告诉我怎么做吗?我现在尝试使用另一个实例化的EviewController身份识别器