我正在开发一个 ipad 应用程序,我使用了一个标签栏作为 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.
}];
}
}
但这不起作用,我的应用程序崩溃了。
我在这里做错了什么?
问候兰吉特