MKMapView shows incorrect location after device rotation
| Originator: | Jeremy.Y.Lawrence | ||
| Number: | rdar://25881324 | Date Originated: | 22 April 2016 |
| Status: | Open | Resolved: | |
| Product: | iOS | Product Version: | 9.3 |
| Classification: | Bug | Reproducible: | Yes |
When using a UIViewController with a MKMapView that presents an additional view controller when the device is rotated to landscape orientation, the map view can end up in a buggy state where programmatically setting the displayed area of the map view will not behave as intended. In this buggy state, when setting a MKMapCamera on the map view, the map view will not center on the center coordinate of the camera, but instead show a coordinate that is displaced vertically (in the UIView space, not north or south) from the center coordinate. This bug occurs when a UIViewController has a MKMapView and is restricted to `.Portrait` orientation. When the device is rotated to landscape orientation, the view controller presents another view controller on top of itself using `presentViewController(_:,animated:,completion:)`, and dismisses this view controller when the device is rotated back to portrait orientation. Before presenting the view controller, setting cameras on the map view works as intended. After rotating to landscape and returning to portrait, setting cameras on the map view will cause the map view to center on coordinates that are vertically offset from the intended coordinate. Additionally, other map view subviews are also displaced (e.g. compass, "legal" link). This behavior was introduced in iOS 9.3. Simulators running iOS 9.2 do not exhibit the same behavior.
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!