Inside:
mapView(_ mapView: MKMapView, regionDidChangeAnimated animated: Bool)
I calculate a level zoom. If this zoom level satisfy a condition I would like disable only zoom in and zoom out remains enabled. Is it possible?
You could set isZoomEnabled
to false
:
This property controls only user interactions with the map. If you set the value of this property to false, you may still change the zoom level programmatically by changing the value in the region property.
According to your need, you could
mapView.isZoomEnabled = false
when it's needed. For instance, you might check the zooming level if it's aiming to increase and disable it.
In addition, Check whether zoom level changed might be useful to your case.
It's impossible disable only zoom-in with MapKit. My solution is: check zoomLevel, if it is greater than a prefixed level reposition map to a fixed zoomLevel.