1

I am building my app on iOS 8 and getting problem with status bar visibility when UIViewController is presented with modalPresentationStyle = UIModalPresentationPageSheet. I read the documentation that new API true value of "modalPresentationCapturesStatusBarAppearance" used to hide status bar when modal presentation is presented, but I am getting no result with this in this modalPresentationStyle. In my application I am not showing status bar. It was working fine with this style in iOS 7 but when it comes to iOS 8 it is giving problem. Here is my code:

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];

I am getting like this:

enter image description here

But the desired output is

enter image description here

Please help !!

Juno
  • 347
  • 2
  • 11
  • Have you found a fix to this problem? I am also having ios8 only issues with the PageSheet style and status bar hidden. Thanks – rwyland Feb 03 '15 at 00:44

1 Answers1

0

Use nav.modalPresentationStyle = UIModalPresentationPopover only

souvickcse
  • 7,742
  • 5
  • 37
  • 64
  • I have used your suggestion but getting this error now. "Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController should have a non-nil sourceView or barButtonItem set before the presentation occurs.'" And app crashes. – Juno Sep 19 '14 at 07:55