In MKMapView
I am having two type of map that is MKMapTypeStandard
and MKMapTypeSatellite
.
I want to replace user location pin to another(location.jpg) image.
The pin image is changing in MKMapTypeStandard
(location.jpg) but in MKMapTypeSatellite
(default image) pin image displayed as default map pin image.
how can i solve this problem in project?
Here is my code.
MKPinAnnotationView *pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:nil];
MKPinAnnotationView *customPinView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:nil];
//customPinView.image = [UIImage imageNamed:@"mappin4"];
if (!pinView)
{
if (annotation == mapView.userLocation)
{
customPinView.image = [UIImage imageNamed:@"mappin4"];
}
else
{
}
customPinView.animatesDrop = NO;
customPinView.canShowCallout = NO;
customPinView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
return customPinView;
} else
{
pinView.annotation = annotation;
}