我无法从第二个UIStoryboard中调用一个。我的第一个故事板-主要,第二管理层。单击UIButton时,不会发生任何操作。我的源代码:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Management" bundle:[NSBundle mainBundle]];
UIViewController *yourViewController = [storyboard instantiateViewControllerWithIdentifier:@"Management"];
[self.navigationController pushViewController:yourViewController animated:YES];发布于 2015-03-20 14:56:02
需要用这个替换旧代码。
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Management" bundle:[NSBundle mainBundle]];
UIViewController *yourViewController = [storyboard instantiateViewControllerWithIdentifier:@"ManagementIDS"];
[self presentViewController:yourViewController animated:YES completion:nil];发布于 2015-03-20 14:35:47
这里可能有很多原因。1.您可能忘记为您的instantiateViewControllerWithIdentifier:@"Management";2设置IBAction出口。故事板名称可能与您在代码3中指定的名称不匹配。情节提要IBAction您确定为该控制器指定了相同的故事板ID吗? 4。为了检查所有这些建议,只需在代码的第一行设置断点并尝试再现情况就足够了。
发布于 2015-03-20 14:36:16
在这段代码中可能会发生许多错误的事情。
首先,确保您的操作连接良好,在操作中放置一个断点,以查看是否正在调用该操作。
其次,确保故事板名称是正确的,在情节提要后面放置一个断点,并检查它是否为零(调试控制台中的po storyboard)。
第二,确保"Management.storyboard“具有标识符"Management”的ViewController。因此,在yourViewController之后放置一个断点,以检查它是否为nil (调试器控制台中的po yourViewController)。
最后,请确保操作所在的视图控制器位于导航控制器内。因此,请检查self.navigationController是否为零(在操作代码停止后,调试器控制台中的po self.navigationController)。
https://stackoverflow.com/questions/29168856
复制相似问题