0

我有一个容器视图控制器,我想以这种方式在其中加载 2 个视图控制器:

- (void)viewDidAppear:(BOOL)animated
{  
    CGSize size = CGSizeMake(320, 480);
    CGSize sizeExpand = CGSizeMake(640, 480); // size of view in popover
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"TabelStoryboard" bundle:[NSBundle mainBundle]];

    UIViewController *yourModalVC =[storyboard instantiateInitialViewController];
    yourModalVC.modalPresentationStyle = UIModalPresentationCurrentContext;
    [self presentModalViewController:yourModalVC animated:YES];
    yourModalVC.contentSizeForViewInPopover = size;
    yourModalVC.view.frame = CGRectMake(00, 00, 320, 480);

    CGSize size2 = CGSizeMake(320, 480);
    CGSize sizeExpand2 = CGSizeMake(640, 480); // size of view in popover
    UIStoryboard *storyboard2 = [UIStoryboard storyboardWithName:@"DetailsGroup" bundle:[NSBundle mainBundle]];

    UIViewController *yourModalVC2 =[storyboard2 instantiateInitialViewController];
    yourModalVC2.modalPresentationStyle = UIModalPresentationCurrentContext;
    [self presentModalViewController:yourModalVC2 animated:YES];
    yourModalVC2.contentSizeForViewInPopover = size2;
    yourModalVC2.view.frame = CGRectMake(320, 00, 320, 480);
}

但只有 2 个负载中的第一个。如果我交换代码的两部分,它总是第一个加载,所以问题不在代码中。我真的可以加载两个视图控制器吗?

4

0 回答 0