0

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?

Ahmad F
  • 30,560
  • 17
  • 97
  • 143
EdoBen
  • 1,676
  • 2
  • 14
  • 24

2 Answers2

0

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.

Ahmad F
  • 30,560
  • 17
  • 97
  • 143
  • But when I set isZoomEnabled to false the zoom level will not change anymore because the map zoom is disable. So I can't reset attribute isZoomEnabled to true – EdoBen Apr 04 '19 at 20:57
0

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.

EdoBen
  • 1,676
  • 2
  • 14
  • 24