O'Reilly logo

iPad Application Development For Dummies, 3rd Edition by Neal Goldstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Putting MapKit through Its Paces

You’ve prepared the ground for some great map functionality, and now it’s time to put the code in place to get that done. Undergirding all this effort is the MapKit.framework. MapKit enables you to bring up a simple map and also do things with your map without having to do much work at all.

The map looks like the maps in the iPad’s built-in applications and creates a seamless mapping experience across multiple applications.

MKMapView

The essence of mapping on the iPad is the MKMapView. It’s a UIView subclass, and as you saw in the previous section, you can use it out of the box to create a map. You use this class as is to display map information and to manipulate the map contents from your application. It enables you to center the map on a given coordinate, specify the size of the area you want to display, and annotate the map with custom information (by becoming a Map View delegate).

When you initialize a Map view, you can specify the initial region for that map to display. You do this by setting the region property of the map. A region is defined by a center point and a horizontal and vertical distance, referred to as the span. The span defines how much of the map will be visible and also determines the zoom level. The smaller the span, the greater the zoom.

The Map view supports these standard map gestures:

check.png Scroll

Pinch (to zoom)

Double-tap ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required