I need to change user's current location Blue Dot annotation with some custom image. How to achieve it?
here my sample code :
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
MKPinAnnotationView *pinView = nil;
if (annotation == mapView.userLocation){
static NSString* AnnotationIdentifier = @"user";
MKPinAnnotationView *pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier];
MKPinAnnotationView *customPinView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier];
customPinView.image = [UIImage imageNamed:@"user.png"];
customPinView.animatesDrop = YES;
customPinView.canShowCallout = YES;
return customPinView;
}
But when I launch the application its showing Red marker.