iOS 8 UIModalPresentationPageSheet,状态栏隐藏

时间:2014-09-19 06:44:38

标签: ipad uiviewcontroller ios8 statusbar uimodalpresentationstyle

我正在iOS 8上构建我的应用程序,并在UIViewController显示modalPresentationStyle = UIModalPresentationPageSheet时遇到状态栏可见性问题。我阅读了文档,当出现模态演示文稿时,用于隐藏状态栏的“modalPresentationCapturesStatusBarAppearance”的新API真值,但我在此modalPresentationStyle中没有得到任何结果。在我的应用程序中,我没有显示状态栏。它在iOS 7中运行良好,但是当涉及到iOS 8时它会产生问题。这是我的代码:

UINavigationController  *nav = [[UINavigationController alloc] initWithRootViewController:viewController];
nav.modalPresentationStyle = UIModalPresentationPageSheet;
nav.modalTransitionStyle=UIModalTransitionStyleCoverVertical;
nav.modalPresentationCapturesStatusBarAppearance = YES; // To hide status bar, doest work with UIModalPresentationPageSheet style
[self.navigationController presentViewController:nav animated:YES completion:NULL];

我是这样的:

enter image description here

但是所需的输出是

enter image description here

请帮助!!

1 个答案:

答案 0 :(得分:0)

仅使用nav.modalPresentationStyle = UIModalPresentationPopover