Customize Google Maps blue dot for current location

后端 未结 3 507
心在旅途
心在旅途 2020-12-19 02:15

I\'m using a 2013 version of Google Maps SDK for iOS. I would like to customize the default blue dot for current location with another icon or pulsing circles around.

<
3条回答
  •  心在旅途
    2020-12-19 02:59

    For Swift 4.0

    When you setup your GMSMapView:

    mapView.isMyLocationEnabled = false
    

    And when user location is updated:

    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
    
        let userLocationMarker = GMSMarker(position: location.coordinate)
        userLocationMarker.icon = UIImage(named: "yourImageName")
        userLocationMarker.map = mapView   
    }
    

提交回复
热议问题