0

Is there one way to customize myLocationButton GoogleMaps ? I want to add my own button with a background image which make the same function as the original Google button

1 Answers1

0

First your Application needs to get current location using CLLocation Manager. If you don't know how, refer to my answer here : For google maps iOS sdk, current location occasionally gets plotted at 0,0

Now for button press action, do this

- (void)locationButtonPressed
{
    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:self.mapView.myLocation.coordinate.latitude
                                                            longitude:self.mapView.myLocation.coordinate.longitude
                                                                 zoom:self.mapView.camera.zoom];
    [self.gMapView animateToCameraPosition:camera];
}

Hope that helps.

Community
  • 1
  • 1
Bharat
  • 340
  • 1
  • 8