Status bar view controller is wrong when a presentation adapts

Originator:douglashill
Number:rdar://22564923 Date Originated:03-Sep-2015 10:18 PM
Status:Fixed in iOS 10 beta 3 Resolved:
Product:iOS SDK Product Version:
Classification: Reproducible:
 
Summary:
Using the default `UIViewControllerBasedStatusBarAppearance`, the status bar style, visibility and update animation are specified by a view controller. When a view controller is presented, whether is becomes the status bar view controller depends on its presentation style. For example, view controllers presented full screen become the status bar view controller, while those in popovers do not.

UIKit seems to determine the status bar view controller at presentation time, and does not update this when a presentation adapts to a different style.

Steps to Reproduce:
• Open and run the attached sample project on iPhone 6 Plus or iPad Air 2 with Split View enabled (because on these devices the trait collections change, resulting in adaptivity).
• Tap to present a view controller.
• Change size class (rotate).

Some specific steps mentioned below:

1. While in landscape, tap the screen to present
2. Rotate to portrait
3. Tap to dismiss
4. Tap to present
5. Rotate to landscape
6. Tap to dismiss

Expected Results:
• When only the dark green master view is visible, the status bar should have light text.
• When the pink detail view is presented in a popover, the status bar should have light text.
• When the pink detail view is presented full screen, the status bar should have dark text.
• These should remain true after rotation.

Actual Results:
• After step 2, the status bar is light over the full screen pink detail view.
• After step 5, the status bar is dark over the dark green master view (while the pink detail view is in a popover).
• After step 6, the status bar remains dark over the dark green master view. Note that the presented view controller is being kept alive by the presenting view controller somewhat unexpectedly.

Version:
iOS 9, Xcode 7.0 beta 6 (7A192o)

Notes:
It seems that UIKit does not call `_setPresentedStatusBarViewController:` when adapting. As an uninformed outsider, I wonder why UIKit uses an instance variable to store the presented status bar view controller and doesn’t recompute it each time.

Workaround: in the delegate method `presentationController:willPresentWithAdaptiveStyle:transitionCoordinator:`, call `_setPresentedStatusBarViewController:` with what we think the status bar view controller should be.

Configuration:
iPad Air 2 simulator and iPhone 6 Plus simulator

Attachments:
'status-bar-adapt.zip' was successfully uploaded.

Comments

https://www.dropbox.com/s/wkzggfaiz9ynd8v/Status%20bar%20adapt%2022564923.zip?dl=0

By douglashill at Sept. 4, 2015, 10:08 a.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!