目前我在我的项目中使用了两个 iPad Storyboard。
第一个 Storyboard有一个登录屏幕和一个表格 View Controller 。当单击单元格时,我想从第一个 Storyboard tableview Controller 调用第二个 Storyboard。通常很容易,但这里的第二个 Storyboard有 UISplitViewController
.
MainSVC *baseView = [[MainSVC alloc] init]; //UISplitViewController
UIStoryboard *storyBoard=[UIStoryboard storyboardWithName:@"Mail_iPad" bundle:nil]; //Second Storyboard
baseView =[storyBoard instantiateViewControllerWithIdentifier:@"MainSVC"]; //MainSVC = Storyboard Name
[self presentViewController:baseView animated:YES completion:nil];
此代码不起作用。我在谷歌搜索,但找不到最佳解决方案。
如何以编程方式调用第二个 Storyboard Split View Controller ?
最佳答案
使用此代码。这应该是工作。 !
UIStoryboard *storyBoard=[UIStoryboard storyboardWithName:@"Mail_iPad" bundle:nil];
UISplitViewController *split = [storyBoard instantiateViewControllerWithIdentifier:@"MainSVC"];
self.view.window.rootViewController = split;
关于ios - 从另一个 Storyboard 以编程方式加载 UISplitViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18117471/