I have a normal map in my iOS app where "Shows Users Location" is enabled - meaning I have my normal blue dot on the map, showing my position and accuracy info. The callout is disabled in code.
But I also have custom MKAnnotationViews that are plotted around the map which all have custom callouts.
This is working fine, but the problem is that when my location is on the location of a MKAnnotationView, the blue dot (MKUserLocation) intercepts the touch, so the MKAnnotationView doesn't get touched.
How can I disable the user interaction on the blue dot so that the touches are intercepted by the MKAnnotationViews and not the blue dot?
This is what I do so far:
- (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation;
{
if (annotation == self.mapView.userLocation)
{
[self.mapView viewForAnnotation:annotation].canShowCallout = NO;
return [self.mapView viewForAnnotation:annotation];
} else {
...
}
}
enabled
toNO
indidAddAnnotationViews
for the user location annotation only. If you wanted to disable interaction on your own annotations, you can do that inviewForAnnotation
when creating your view. – Farlay