質問

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