Reputation: 228
I am using iOS Google map SDK and I tried to change the current location blue color dot to red color dot. But I couldn't find the way.
Is it possible to change the current location blue color dot to custom (red dot) color?
If yes, please help me on this.
Thanks in advance
Upvotes: 3
Views: 1789
Reputation: 126
If you are looking to change the current location icon, just find the GMSSprites-0-1x.png icons in the resources of google maps and replace them with your required icons.
Upvotes: 4
Reputation: 12344
You should include MKMapViewDelegate. Call the method
- (MKAnnotationView *)mapView:(MKMapView *)mapView
viewForAnnotation:(id<MKAnnotation>)annotation;
Change the annotation view to a custom view as you like. You can give any image.
- (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:@"YourLocationimage.png"];
}
else{
customPinView.image = [UIImage imageNamed:@"Notyourlocationimage.png"];
}
return customPinView;
} else {
pinView.annotation = annotation;
}
return pinView;
}
Upvotes: -1