views:

514

answers:

1

I have mapkit view and i need to fix zoom step. User must only increase or decrease by 4 times. How i can do it in MapKit?

+1  A: 

The map doesn't provide a method to restrict the zoom increment. I should also say that the default implementation of the map view on the iPhone leads to better user experience I think. I personally dislike apps that limit my capabilities for no good reason.

To answer your question though, you can manually control your zooming, by disabling MKMapView.zoomEnabled property. Then you can expose a zoom buttons that change the shown map region, using setRegion:animated:.

Here is a sample code on how to zoom the map:

-(void)zoomMap:(MKMapView *)map withLevelMultiple:(void)levelMultiplier {
  MKCoordinateRegion region = map.region;
  region.span.latitudeDelta /= levelMultiplier;
  region.span.longitudeDelta /= levelMultiplier;
  [map setRegion:region animated:YES];
}
notnoop