How to Make Black color to blue GPS Point in ios using swift??
Asked
Active
Viewed 226 times
1 Answers
0
This is the default view
for current location
in MKMapView
,if you wan to change it then you should hide this current location
(i.e. by setting - yourMapView.showsUserLocation
to false
) and you can add custom annotation
to that latlong
, i mean custom image (black image) that you want to show instead of blue!
Take a look on below delegate,
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
static NSString* AnnotationIdentifier = @"Annotation";
MKPinAnnotationView *pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier];
if (!pinView) {
MKPinAnnotationView *customPinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease];
if (annotation == mapView.userLocation){
customPinView.image = [UIImage imageNamed:@"myCarImage.png"];
}
else{
customPinView.image = [UIImage imageNamed:@"mySomeOtherImage.png"];
}
customPinView.animatesDrop = NO;
customPinView.canShowCallout = YES;
return customPinView;
} else {
pinView.annotation = annotation;
}
return pinView;
}
Reference : This SO Post!

Community
- 1
- 1

Ketan Parmar
- 27,092
- 9
- 50
- 75