Customizing MKMapView Needs Apple’s Help

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.

ios10mapsnocompass

For the observant, this affordance causes the compass view to now show up vertically lower than it normally does.

ios10mapswithcompass

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.

experimentalappwithcompass

Some apps, like Starbucks, don’t even try to deal with such overlapping views when they happen.

starbucksappwithcompass

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.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s