我使用的是Google地圖SDK,當用戶移動時我必須繪製折線,目前只是在標記移動到特定位置之前繪製路徑。我必須同時繪製路徑和移動引腳。我如何在Google地圖上設置GMSPolyline的動畫效果ios
看看這個視頻:https://www.dropbox.com/s/q5kdjf4iq0337vg/Map_Sample.mov?dl=0
這裏是我的代碼
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let location = locations.last!
userPath.addCoordinate(location.coordinate) //userPath -> GMSMutablePath
let polyline = GMSPolyline(path: userPath)
polyline.strokeColor = UIColor(red: 0, green: 191/255.0, blue: 1, alpha: 0.8)
polyline.strokeWidth = 5
CATransaction.begin()
CATransaction.setAnimationDuration(2.0)
self.userMarker.position = location.coordinate
self.userMarker.rotation = location.course
polyline.map = self.googleMapView
CATransaction.commit()
}
你想做什麼?沒有完全確定。你能詳細解釋一下嗎? –
編輯過的問題,你現在明白了嗎?我必須在引腳移動時繪製路徑 – Bose
嗨,有人遇到同樣的問題? – Bose