How to disable user interaction on MKMapView?

旧城冷巷雨未停 提交于 2019-11-28 06:46:38
Rob

The key is to disable zooms and scrolls, such as:

self.mapView.zoomEnabled = false;
self.mapView.scrollEnabled = false;
self.mapView.userInteractionEnabled = false;

You can do this in Interface Builder like this:

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

You can set the enabled property of MKAnnotationView to NO

For disabling Zoom, you can set mapView.zoomEnabled = FALSE;

enabled

A Boolean value indicating whether the annotation is enabled.

@property (nonatomic, getter=isEnabled) BOOL enabled

Discussion

The default value of this property is YES. If the value of this property is NO, the annotation view ignores touch events and cannot be selected. Subclasses may also display the annotation contents differently depending on the value of this property.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!