MKTileOverlay, MKMapSnapshotter & MKDirections
Unless you work with MKMapView on a regular basis, the last you may have heard about the current state of cartography on iOS may not have been under the cheeriest of circumstances. Even now, years after the ire of armchair usability experts has moved on to iOS 7’s distinct “look and feel”, the phrase “Apple Maps” still does not inspire confidence in the average developer.
Therefore, it may come as a surprise maps on iOS have gotten quite a bit better in the intervening releases. Quite good, in fact—especially with the new mapping APIs introduced in iOS 7. These new APIs not only expose the advanced presentational functionality seen in Maps, but provide workarounds for MapKit’s limitations.
→ nshipster.com/mktileoverlay-mkmapsnapshotter-mkdirections/
iOS 7 quietly brought three powerful new MapKit tools that fixed many old complaints about Apple Maps:
MKTileOverlay
Lets you replace Apple’s map tiles with any other tile server (OpenStreetMap, Mapbox, or your own). Just give a URL template and setcanReplaceMapContent = true. You can even subclass it for caching or custom tile schemes.MKMapSnapshotter
Creates clean, static map images programmatically (perfect for sharing, thumbnails, or offline use). You set region, size, and camera, then get back a UIImage with annotations drawn on top if you wish.MKDirections
Calculates real driving, walking, or transit routes using Apple’s data. Returns full MKRoute objects with steps, polylines, expected time, and advisories – all free and without quota limits.
Together these solved the biggest developer gripes: ugly base maps, no static map images, and no routing. Even today they remain some of the most generous (and under-used) mapping APIs on iOS.
Category:
Tags:
Year: