A modally presented UIViewController is unable to hide the status bar

Originator:michaelab1
Number:rdar://27435072 Date Originated:19-7-2016
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 10b3
Classification:Bug Reproducible:Always
 
Summary:
When a UIViewController is presented modally from another UIViewController, it is unable to hide or otherwise affect the status bar. If the presented view controller returns "true" from prefersStatusBarHidden() this has no effect. Prior to iOS 9 this worked fine.

Steps to Reproduce:
1. Create an app which presents a 2nd view controller modally (presentViewController(animated:, completion:)).
2. In the 2nd VC implement prefersStatusBarHidden() so that it always returns true


Expected Results:
When the 2nd VC is presented, the status bar should be hidden.

Actual Results:
When the 2nd VC is presented the status bar remains unchanged

Regression:
This was not a problem prior to iOS 10.

Notes:
The only workaround is for the presenting VC to hide the status bar before it presents the 2nd VC, which is not always an ideal way to do things.

Comments

I have attached two iOS sample projects: - StatusBarBug demonstrates the bug occurring in iOS 10 (open with Xcode 8) - the status bar is not hidden. - StatusBarTest shows that the same code (other than differences due to Swift 2.2 vs Swift 3.0) hides the status bar in iOS 9.

I should clarify that the problem is occurring when using the .custom modalPresentationStyle which I didn't make clear in the original bug report.

The fact that I haven't actually supplied a custom transition animator is not relevant (UIKit just uses the default transition if no custom transition is supplied). In my app project I get the same behaviour with a full custom transition implemented.

Link for StatusBarBug.zip: https://dl.dropboxusercontent.com/u/1020204/StatusBarBug.zip Link for StatusBarTest.zip: https://dl.dropboxusercontent.com/u/1020204/StatusBarTest.zip

By michaelab1 at July 26, 2016, 8:40 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!