3
votes

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

3
Have your tried custom marker ?Abhishek Sharma
Yes, I tried to replace current location icon with custom marker. But custom marker is differ from current location icon. Here I need to customise the current location icon color.Dsh
Can you show me the current icon?Abhishek Sharma
Need to change the current location blue colour dot marker to some other colour as like in iOS Uber application.Dsh
marker.icon = GMSMarker.markerImage(with: .black)Abhishek Sharma

3 Answers

4
votes

Find the path as in the image

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.

1
votes

just change the tint color. mapView.tintColor = UIColor.red

-1
votes

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;
}