ios - 如何在 swift 代码中更改谷歌地图中的位置箭头图标?

标签 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()
    }

}

最佳答案

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

让 london = GMSMarker(position: position)

london.title = "伦敦"

london.icon = UIImage(named: "here will be your image name")

london.map = mapView;

关于ios - 如何在 swift 代码中更改谷歌地图中的位置箭头图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35552822/

相关文章:

ios - Xamarin iOS PushViewController 空引用异常

ios - Swiftui Pan Gesture 获取 View 的水平位置

Swift 1.2 [AnyObject] 没有名为 'objectForKey' 的成员

Javascript,更改谷歌地图标记颜色

android - 如何在 android 中本地化谷歌地图,并使搜索 URL 接受不同语言的参数

android - React-native:将数据保存在设备内存中

ios - 从 Spotify API 歌曲列表中播放歌曲

ios - 带有 Segues 到多个 View 的 TableView

function - Swift 中的静态函数变量

android - 带有 iOS 和 Google 标记的 map 的 URL?