Graphics Programs Reference
In-Depth Information
MKMapView
must implement a method that zooms in on a location. Let's track down this
method in the API Reference.
Search for the
MKMapView
class. In the class reference page, look for
Manipulating the
Visible Portion of the Map
in the
Tasks
section. There are a handful of methods and prop-
erties in this section; we'll start at the top with the
region
property. The details for
re-
gion
tell us that this property is of type
MKCoordinateRegion
and that it provides
an implicit zoom. Sounds perfect. But to set this property, we need to know more about
MKCoordinateRegion
.
Search for
MKCoordinateRegion
. Its details are in the
Map Kit Data Types Referen-
ce
.
MKCoordinateRegion
has two members of types
CLLocationCoordin-
ate2D
and
MKCoordinateSpan
. The
CLLocationCoordinate2D
is the center of
Figure 5.12 Parts of an MKCoordinateRegion
To set the
region
property of the map view, we'll need to package up one of these in-
stances, so let's find out how we can do this. Search again for
MKCoordinateRegion
and this time select the
Map Kit Functions Reference
. One of these functions,