在iPad中一个接一个地呈现两个ModalviewControllers

时间:2013-06-06 06:48:41

标签: ios uisplitviewcontroller modalviewcontroller ipad

我正在开发一个ipad应用程序,我使用tabbar作为rootViewController,在每个选项卡中我都有splitviewControllers。现在,我通过这种方式单击按钮来呈现ModalView

- (void)someFunction
{

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
        {
            AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
           TestViewController *test = [[TestViewController alloc]initWithNibName:@"TestViewController" bundle:nil];
            moveNote.modalPresentationStyle = UIModalPresentationFormSheet;

            [appDelegate.splitViewController2 presentModalViewController:test animated:YES];
            test.view.superview.bounds = CGRectMake(0, 0, 540, 350);//Dimensions of ModalView.
         }

}

我通过SplitviewController呈现ModalView。

现在这正确打开了。现在在里面我有一个按钮,点击其中我想解雇这个ModalView并呈现另一个ModalView。为此我写了下面的代码

- (void)closeTest
{
[self dismissViewControllerAnimated:YES
                                 completion:^{


                                     EditViewController *editViewController = [[EditViewController alloc] initWithNibName:@"EditViewController" bundle:nil];
                                     editViewController.modalPresentationStyle = UIModalPresentationFormSheet;

                                     [appDelegate.splitViewController2 presentModalViewController:editViewController animated:YES];
                                     editViewController.view.superview.bounds = CGRectMake(0, 0, 540, 350);//Dimensions of ModalView.
                                     editViewController.page = 3;              


                                     //Call delegate function.
                                 }];      
    }
}

但这不起作用,我的应用程序崩溃了。

我在这里做错了什么?

此致 兰吉特

0 个答案:

没有答案