1

我在iOS 8上构建应用程序,并在UIViewController与modalPresentationStyle = UIModalPresentationPageSheet一起呈现时出现状态栏可见性问题。我阅读了文档,提供了modalPresentationCapturesStatusBarAppearance用于隐藏状态栏的新API的真实值,但在此模式呈现方式中我没有得到任何结果。在我的应用程序中,我没有显示状态栏。它在iOS 7中使用这种风格工作得很好,但是当涉及到iOS 8时,它会产生问题。这里是我的代码:iOS 8隐藏状态栏的UIModalPresentationPageSheet

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

请帮助!

+0

您是否发现此问题的修复?我也有隐藏PageSheet样式和状态栏的ios8问题。谢谢 – rwyland 2015-02-03 00:44:30

回答

0

使用nav.modalPresentationStyle = UIModalPresentationPopover只有

+0

我已经使用你的建议,但现在得到这个错误。 “由于未捕获的异常'NSGenericException'而终止应用程序,原因是:'UIPopoverPresentationController应该在演示发生之前设置非零的sourceView或barButtonItem。'”并且应用程序崩溃。 – Juno 2014-09-19 07:55:58