1

Currently I am using two iPad storyboards in my project.

The first storyboard has a Login screen and a tableview controller. I want to call the second storyboard from the first storyboard tableview controller, when the cell is clicked. Normally it's easy, but here the second story board has a 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];

This code is not working. I searched in google, but couldn't find the best solution.

How can I call second storyboard splitview controller programmatically?

4

2 回答 2

4

使用此代码。这应该是工作。!

    UIStoryboard *storyBoard=[UIStoryboard storyboardWithName:@"Mail_iPad" bundle:nil];

    UISplitViewController *split = [storyBoard instantiateViewControllerWithIdentifier:@"MainSVC"];
    self.view.window.rootViewController = split;
于 2013-08-10T16:35:59.310 回答
0

不要分配拆分视图控制器的另一个实例。应该这样做

UIStoryboard *storyBoard=[UIStoryboard storyboardWithName:@"Mail_iPad" bundle:nil]; //Second Storyboard

MainSVC *baseView =(MainSVC *)[storyBoard instantiateViewControllerWithIdentifier:@"MainSVC"]; //MainSVC = Storyboard Name
[self presentViewController:baseView animated:YES completion:nil];
于 2013-08-08T05:11:08.860 回答