SafeAreaLayoutGuide is altered for UIStatusBar during transitions

Originator:harshilshah1910
Number:rdar://34459585 Date Originated:15-Sep-2017 07:14 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:iOS 11 GM
Classification:UI/Usability Reproducible:Always
 
Summary:
When transitioning between two view controllers that have different values for `prefersStatusBarHidden`, the value of the SafeAreaLayoutGuide for both view controllers is adjusted as well

This results in layout changes in both views during the transition, showing intermediate states which do not reflect the actual design of either view when presented by themselves

In the attached example, two view controllers are transitioned between using tap gestures. Both have one coloured subview, both of which are constrained to their superview’s safeAreaLayoutGuide in terms of the top, bottom, leading, and trailing anchors. One hides the status bar, while the other shows it.

On transitioning between the two, however, the safeAreLayoutGuides are animated from the value from that of the presenting to that for the presented view controller, thus hiding the status bar in the view which shows it, and vice versa.

Steps to Reproduce:
1. Prepare two view controllers which are laid out with respect to their view’s `.safeAreaLayoutGuide`, and differ only in that one shows which the other hides the status bar using `prefersStatusBarHidden`
2. Show one of the two (the bug can be reproduced while presenting and dismissing from either view controller)

Expected Results:
Both view controllers should be laid out with respect to their own `prefersStatusBarHidden` property and shouldn’t have their layouts adjusted as per another view controllers’ even intermittently 

Actual Results:
The view controller which shows the status bar briefly is laid out as if it hides it, and vice versa

Version:
iOS 11 GM

Notes:
This behaviour does not occur on iPhone X since the SafeAreaLayoutGuide is not determined by the UIStatusBar’s state on that device

Comments


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!