Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all, <strong>MKMapView</strong> does not use/have a predefined set of zoom levels like Google Maps does.</p> <p>Instead, the visible area of a MKMapView is described using <strong>MKCoordinateRegion</strong>, which consists of two values:</p> <ol> <li><strong>center</strong> (the center point of the region), and</li> <li><strong>span</strong> (the size of the visible area around center).</li> </ol> <p>The center point should be obvious (it's the center point of the region.)</p> <p>However, span (which is a <strong>MKCoordinateSpan</strong>) consists of:</p> <ol> <li><strong>latitudeDelta</strong> (the vertical distance represented by the region), and</li> <li><strong>longitudeDelta</strong> (the horizontal distance represented by the region).</li> </ol> <p>A brief example. Here's a toy MKCoordinateRegion:</p> <ol> <li>center: <ul> <li>latitude: 0</li> <li>longitude: 0</li> </ul></li> <li>span: <ul> <li>latitudeDelta: 8</li> <li>longitudeDelta: 6</li> </ul></li> </ol> <p>The region could be described using its min and max coordinates as follows:</p> <ol> <li>min coordinate (lower left-hand point): <ul> <li>latitude: -4</li> <li>longitude: -3</li> </ul></li> <li>max coordinate (upper right-hand point): <ul> <li>latitude: 4</li> <li>longitude: 3</li> </ul></li> </ol> <p>So, you can specify zoom levels around a center point by using an appropriately sized MKCoordinateSpan. As an approximation of Google's numeric zoom levels, you could reverse engineer the span sizes that Google uses for a given zoom level and create a span, accordingly. (Google describes their view regions in the same way that MKMapView does, as a center + span, so you can pull these values out of Google Maps.)</p> <p>As for restricting the region, you may play w/ this delegate method:</p> <pre><code>mapView:regionWillChangeAnimated </code></pre> <p>e.g. by resizing the region back into your allowed zoom levels. (Kind of like how table views will let you scroll past the edge, but will then rubber band back into place.) However, your mileage may vary, since I haven't used it for this purpose.</p> <p>btw, there are definite fixes/improvements in OS 3.1 to aspects of MapKit that were giving me trouble in 3.0.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload