Is there way to limit MKMapView maximum zoom level?

If you’re working with iOS 7+ only, there’s a new camera.altitude property that you can get/set to enforce a zoom level. Its equivalent to azdev’s solution, but no external code is required.

In testing, I also discovered that it was possible to enter an infinite loop if you repeatedly tried to zoom in at detail, so I have a var to prevent that in my code below.

- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
    // enforce maximum zoom level
    if (_mapView.camera.altitude < 120.00 && !_modifyingMap) {
        _modifyingMap = YES; // prevents strange infinite loop case

        _mapView.camera.altitude = 120.00;

        _modifyingMap = NO;
    }
}

Leave a Comment