【问题标题】:Change Location Button Image - Google Maps iOS SDK更改位置按钮图像 - Google Maps iOS SDK
【发布时间】:2020-04-19 01:54:14
【问题描述】:

我的应用程序的位置功能已正常工作,但我想为位置按钮添加自定义图像。我该怎么做呢?

【问题讨论】:

    标签: ios google-maps


    【解决方案1】:

    我创建了一个全新的按钮,并使用以下代码将其用作位置按钮:

    @IBAction func myLocationButton(_ sender: UIButton) {
            guard let lat = self.mapView.myLocation?.coordinate.latitude, let lng = self.mapView.myLocation?.coordinate.longitude else {
                return
            }
            
            let camera = GMSCameraPosition.camera(withLatitude: lat, longitude: lng, zoom: 16)
            self.mapView.animate(to: camera)
        }
    

    最终结果:

    【讨论】:

      猜你喜欢
      • 2013-01-07
      • 2013-05-28
      • 1970-01-01
      • 2015-03-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-17
      • 2013-10-27
      相关资源
      最近更新 更多