Adding Controls To MKMapView Is Possible But May Overlap Other Items
The Problem
Apple’s iOS class MKMapView has a lot of options for customization, but one way it needs improvement is when a developer needs to add controls to its interface. In iOS 10, Apple’s Maps app moved its options from a button bar across the bottom to a floating, vertically-oriented segment control in the upper right, which expands the app’s visual real estate for its content.
For the observant, this affordance causes the compass view to now show up vertically lower than it normally does.
I wanted to use a similar control as Apple’s Maps to provide the same options as well as another to return to where a photo was taken should the user navigate away from it. However, the solution to this is very difficult and fraught with differences when running on iOS 9 and iOS 10.
Some apps, like Starbucks, don’t even try to deal with such overlapping views when they happen.
The Solution
While a developer can override layoutSubviews on MKMapView to see where overlaps can occur with their own views, these kinds of views need to be supported by Apple.
I’ve written rdar://29367150 with my needs, and any developers who also have such a need should write their own feature requests.