Dsh
Dsh

Reputation: 228

iOS Google map SDK - Is possible to current location blue dot marker to red dot

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

Answers (3)

Naga Syam
Naga Syam

Reputation: 126

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.

Upvotes: 4

Jay Patel
Jay Patel

Reputation: 2740

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

Upvotes: 1

Fawad Masud
Fawad Masud

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

Related Questions