【问题标题】:iOS 8 UIModalPresentationPageSheet with status bar hidden隐藏状态栏的 iOS 8 UIModalPresentationPageSheet
【发布时间】:2014-09-19 06:44:37
【问题描述】:

我正在 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];

我是这样的:

但是想要的输出是

请帮忙!!

【问题讨论】:

  • 您找到解决此问题的方法了吗?我也只有 ios8 的 PageSheet 样式和状态栏隐藏问题。谢谢

标签: ipad uiviewcontroller ios8 statusbar uimodalpresentationstyle


【解决方案1】:

仅使用nav.modalPresentationStyle = UIModalPresentationPopover

【讨论】:

  • 我已经使用了您的建议,但现在收到此错误。 “由于未捕获的异常'NSGenericException'而终止应用程序,原因:'UIPopoverPresentationController 应该在演示发生之前设置非零的 sourceView 或 barButtonItem。'”并且应用程序崩溃。
猜你喜欢
  • 2015-04-21
  • 2014-11-14
  • 2017-03-20
  • 1970-01-01
  • 1970-01-01
  • 2014-11-26
  • 2013-09-20
  • 2014-04-23
  • 2013-09-29
相关资源
最近更新 更多