I have a MKMapView and a few MKAnnotationViews on my map.

When a certain event happens, I would like to disable user interaction on my MKMapView but leave interaction on my MKAnnotationView available.

Ideally, it would be

self.mapView.userInteraction = NO;
self.myAnnotationView.userInteraction = YES;

Printing

[self.mapView recursiveDescription]

I have found that my annotation view is nested in MKNewAnnotationContainerView which doesn't have a publicly exposed property on Apple's class reference.

Any ideas?

有帮助吗?

解决方案

On the mapView, set scrollEnabled, zoomEnabled, pitchEnabled, and rotateEnabled to NO and leave userInteractionEnabled as YES.

This way, the annotation views will still be enabled.

For pitchEnabled and rotateEnabled, you may want to check if those properties exist before setting them (eg. check if the map view respondsToSelector:@selector(setPitchEnabled), etc.) since they were added in iOS 7.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top