这是我的代码,我想更改位置箭头图标(蓝点)。我如何用快速代码做到这一点。我正在使用谷歌地图!我附上了我想做的照片。
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/