How to disable user interaction on MKMapView?
The key is to disable zooms and scrolls.
In Objective-C:
self.mapView.zoomEnabled = false;self.mapView.scrollEnabled = false;self.mapView.userInteractionEnabled = false;
Or Swift:
mapView.isZoomEnabled = falsemapView.isScrollEnabled = falsemapView.isUserInteractionEnabled = false
By the way, if you want a static map, you might consider using MKMapSnapshotter
instead. This creates an image representation of a map. If you have annotations or overlays, you have to render them manually, but, depending upon your use-case, map snapshots might do the job.
How about this little hack! just place UIView
on top of the MKMapView
having all the same frame details. Also note that the backgroundColor
of this view should be clearColor