2个视图控制器1

时间:2012-10-24 16:52:41

标签: ios cocoa-touch

我有一个容器视图控制器,我想以这种方式在其中加载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个负载中的第一个。如果我交换代码的两个部分,它总是第一个加载,所以问题不在代码中。我可以实际加载两个视图控制器吗?

0 个答案:

没有答案