Applying a transform to a view recalculates its safeAreaInsets

Number:rdar://35532074 Date Originated:14-Nov-2017 10:00 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:11.1
Classification:Other Bug Reproducible:Always
When a transform is applied to a view, it’s safeAreaInsets are recalculated with respect to the effective frame of the presentation. As a result of this, subviews laid out with respect to safeAreaLayoutGuides are moved.

This is in contrast to the documentation for UIView’s transform property[1], which states:
“In iOS 8.0 and later, the transform property does not affect Auto Layout. Auto layout calculates a view’s alignment rectangle based on its untransformed frame.”

Calculating the view’s safeAreaInsets per the untransformed frame seems like the more correct method. Apart from subviews laid out with respect to safeAreaLayoutGuides, as best as I can tell, transforms do not cause any layout changes in subviews. It seems only right that safeAreaInsets follow the same established pattern


Steps to Reproduce:
1. Lay out a subview with respect to UIViewController’s view’s safeAreaLayoutGuides. As of now, depending on the device, the subview should be inset along the edges, depending on the device and orientation
2. Apply a CGAffineTransform to the view which scales it to 0.5 along both axes

Expected Results:
When the view scales, all elements within it appear to be the same, just zoomed out. The subview should still be inset along the same edges, and with proportional inset values.

Actual Results:
After the transform is applied, the view’s safeAreaInsets are updated to .zero, and the subview now covers the entirety of the parent view




Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at 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!