如何在快速代码中更改谷歌地图中的位置箭头图标?

时间:2016-02-22 11:47:51

标签: ios swift google-maps

这是我的代码,我想更改位置箭头图标(蓝点)。我如何在快速代码中完成它。我正在使用谷歌地图!我附上照片,这是我想要的。

enter image description here

func moveCamera(marker:GMSMarker){
     map.camera = GMSCameraPosition(target: marker.position, zoom: 12, bearing: 0, viewingAngle: 0)
}

func placeMarkersInMap(){
    var marker:GMSMarker = GMSMarker()
    if(addressArray.count > 0){
        for add in addressArray{
            let position = CLLocationCoordinate2DMake(add.longitud, add.latitude)
            marker = GMSMarker(position: position)
            marker.appearAnimation = kGMSMarkerAnimationPop
            marker.icon = UIImage(named: "marker")
            marker.title = add.location
            marker.snippet = "\nTel. \(add.tel)"
            marker.infoWindowAnchor = CGPointMake(0.44, 0.45)
            marker.map = map

        }
        moveCamera(marker)
    }

}

func locationManager(manager: CLLocationManager, didChangeAuthorizationStatus status: CLAuthorizationStatus) {
    if status == .AuthorizedWhenInUse {

        locationManager.startUpdatingLocation()

        map.myLocationEnabled = true
        map.settings.myLocationButton = true

    }
}

func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
    if let location = locations.first {

        locationManager.stopUpdatingLocation()
    }

}

1 个答案:

答案 0 :(得分:0)

让position = CLLocationCoordinate2DMake(//这里将是你的坐标)

让伦敦= GMSMarker(职位:职位)

london.title =“伦敦”

london.icon = UIImage(名称:“这里将是你的图像名称”)

london.map = mapView;