自定义 myLocationButton Google 地图 iOS SKD

Custom myLocationButton Google maps iOS SKD

有没有一种方法可以自定义 myLocationButton Google地图?我想添加我自己的带有背景图像的按钮,其功能与原始 Google 按钮

相同

首先,您的应用程序需要使用 CLLocation Manager 获取当前位置。如果你不知道怎么做,请参考我的回答:For google maps iOS sdk, current location occasionally gets plotted at 0,0

现在对于按钮按下操作,执行此操作

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

希望对您有所帮助。