3

在 iPad 上基于 TabBar 的应用程序上,有没有办法在“全屏”中显示模式?

我有一个仅限景观的应用程序(如果有区别的话),我想以模态方式展示的项目我想全屏展示,填满整个屏幕只是为了澄清。我可以在“PageSheet”中很好地呈现它,并且“FormSheet”很好,在模态视图笔尖上进行了一些按钮调整之后,但是一旦我尝试“FullScreen”,背景就会变白(尽管TabBar仍然存在),并且如果我重试按下按钮(不重新启动模拟器),它不会响应。

用于呈现模态视图的按钮所在的视图是 CountryViewController.m 并具有以下操作:

-(IBAction) showNewModal:(id)sender {
modalContent.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
modalContent.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:modalContent animated:YES];
}

这段代码在没有 TabBar 的情况下可以正常工作,我已经意识到。我已经寻找了几个小时来添加到此代码甚至 AppDelegate.h 和 .m 文件中的内容,但到目前为止,它要么无响应(奇怪的是没有显示错误)或上述空白。

4

1 回答 1

6

以我的经验,问题来自于从错误的控制器中呈现模态。

[self.tabBarController presentModalViewController:modalContent animated:YES];

应该管用

如果您使用 iOS 4,一个(也许)更好的选择是使用:

[[UIApplication sharedApplication].keyWindow.rootViewController presentModalViewController:modalContent animated:YES];
于 2011-07-13T17:38:36.920 回答