我有一个UIViewController
我已经放置了一个按钮并且有一个SplitViewController
,当我按下按钮点击SplitViewController
时它在模拟器中正常工作,但是当我在iPhone上运行它会给我以下错误。
2015-12-08 15:28:54.069 Wazapper [1968:60b] ***由于未被捕获的异常终止应用程序' NSInvalidArgumentException',原因:'故事板()没有'包含一个带有标识符的视图控制器' UISplitViewController''
这是我的代码块。
-(void)setupRootViewController:(BOOL) animated {
NSString *storyboardName=@"Main";
UIViewController *newController = nil;
UIStoryboard *board = [UIStoryboard storyboardWithName:storyboardName bundle:[NSBundle mainBundle]];
UIViewAnimationOptions transition = UIViewAnimationOptionTransitionNone;
newController = [board instantiateViewControllerWithIdentifier:@"UISplitViewController"];
if (animated) {
[UIView transitionWithView: self.window duration:0.5 options:transition animations:^{
self.window.rootViewController = newController;
} completion:^(BOOL finished) {
NSLog(@"setup root view controller finished");
self.window.rootViewController = newController;
}];
}else{
self.window.rootViewController = newController;
}
}