My app takes user permission and move the map to the location. And at that position by default MapKit
add a blue icon which is generating some pulse.
I\'v
Unfortunately you cannot simply alter the behaviour of the standard annotation; you need to take over display of the annotation view yourself.
The user location is a map annotation of type MKUserLocation
. If you implement the MKMapViewDelegate
method viewForAnnotation
and the map is displaying the user's location then the delegate method will be called with an instance of MKUserLocation
- your responsibility is to either return nil
, in which case the standard annotation view will be displayed, or return an instance of MKAnnotationView
which will be displayed instead.
You can code something like:
- (MKAnnotationView *)mapView:(MKMapView *)mapView
viewForAnnotation:(id<MKAnnotation>)annotation {
if ([annotation isKindOfClass:[MKUserLocation class]]) {
return [[MyPulsingViewAnnotation alloc] initWithUserLocation:annotation];
}
return nil;
}
As for performing some animation when the 'pulse' intersects another annotation, you will need to pass the other annotation locations to your pulsing view and check the coordinates when you run the animation.