5

There is a lot of questions and answers on stackoverflow about max zoom for MKMapView, for exmaple:

Is there way to limit MKMapView maximum zoom level?

Unfortunately non of the answers actually worked for me (or I just did not implement correctly). I was not able to simulate the behavior that native map has, that would be - restricting zoom level without 'bouncing' or resuming back.

This is my code that used:

- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
{ 
    if( mapView.region.span.latitudeDelta<0.001 || mapView.region.span.longitudeDelta<0.001){
        MKCoordinateRegion region =mapView.region;
        region.span = MKCoordinateSpanMake(0.001, 0.001);
        mapView.region = region;
        [mapView setRegion:mapView.region animated:NO];
    }
}

When a user pinch and zoom map and the map reaches the max zoom (set by me), the map should not zoom in and then bounce back. Is it possible?

Community
  • 1
  • 1
sash
  • 8,423
  • 5
  • 63
  • 74

1 Answers1

0

With my knowledge, I don't think it's actually possible to set max zoom or min zoom without making it yourself. But I know that if you use the Google Map SDK, you can actually set a max and a min zoom for the map: https://developers.google.com/maps/documentation/ios/reference/interface_g_m_s_map_view

Dominique Alexandre
  • 1,023
  • 10
  • 29
Hugo
  • 295
  • 2
  • 15