【发布时间】:2014-09-24 08:19:30
【问题描述】:
我有一个 UISplitViewController(是 rootViewController) 和一个 UIViewController,vc1。
我正在尝试通过 MasterViewController 部分的拆分视图控制器呈现 vc1:
vc1.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentViewController:vc1 animated:YES completion:nil];
这引发了一个异常:
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: 'Application tried to present modally an active
controller <MasterViewController: 0x8c5dd30>.'
...然后崩溃。
试过这个:
[self.splitViewController presentViewController:vc1 animated:YES completion:nil];
这引发了一个异常:
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason:'Application tried to present modally an active
controller <UISplitViewController:0x8c7e3a0>.'
但是,如果我尝试使用界面构建器(segues),它可以工作。
我如何以编程方式在拆分视图控制器上以模态方式(作为页面表或表单表)呈现视图控制器?
【问题讨论】:
-
vc1 在 UINavigationController 中吗?
-
@cortez 不,它是分开的。
标签: ios ipad uiviewcontroller uisplitviewcontroller