【问题标题】:Custom myLocationButton Google maps iOS SKD自定义我的位置按钮 Google 地图 iOS SDK
【发布时间】:2016-07-13 00:29:32
【问题描述】:

是否有一种方法可以自定义 myLocationButton GoogleMaps ?我想添加我自己的带有背景图像的按钮,它与原始 Google 按钮具有相同的功能

【问题讨论】:

    标签: ios google-maps location


    【解决方案1】:

    首先,您的应用程序需要使用 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];
    }
    

    希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 2014-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-28
      • 1970-01-01
      • 1970-01-01
      • 2016-03-25
      相关资源
      最近更新 更多