6

有没有MKPolyline比在 mapView 中删除和添加新覆盖更好的方法来更新坐标?

var a:[CLLocationCoordinate2D] = []  
var testline = MKPolyline()
var coords1 = CLLocationCoordinate2D(latitude: 52.167894, longitude: 17.077399)
var coords2 = CLLocationCoordinate2D(latitude: 52.168776, longitude: 17.081326)
var coords3 = CLLocationCoordinate2D(latitude: 52.167921, longitude: 17.083730)
var testcoords:[CLLocationCoordinate2D] = [coords1,coords2]
testline = MKPolyline(coordinates: &testcoords, count: testcoords.count)
self.mapView.addOverlay(testline)

self.mapView.removeOverlay(testline)
testcoords = [coords1,coords2,coords3]
testline = MKPolyline(coordinates: &testcoords, count: testcoords.count)
self.mapView.addOverlay(testline)
4

0 回答 0