繁体   English   中英

禁用MKMapView的所有用户交互,但给定的MKAnnotationView除外

[英]Disable all user interaction for MKMapView except for a given MKAnnotationView

我的地图上有一个MKMapView和一些MKAnnotationViews。

当某个事件发生时,我想在我的MKMapView上禁用用户交互,但在我的MKAnnotationView上保留交互。

理想情况下,它会

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

印花

[self.mapView recursiveDescription]

我发现我的注释视图嵌套在MKNewAnnotationContainerView中,它在Apple的类引用上没有公开的属性。

有任何想法吗?

在mapView上,将scrollEnabledzoomEnabledpitchEnabledrotateEnabledNO并将userInteractionEnabled保留为YES

这样,仍将启用注释视图。

对于pitchEnabledrotateEnabled ,您可能希望在设置它们之前检查这些属性是否存在(例如,检查地图视图respondsToSelector:@selector(setPitchEnabled)等),因为它们是在iOS 7中添加的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM