有没有更新MKPolyline坐标的方法?

时间:2014-09-22 11:08:40

标签: ios swift mkmapview mkpolyline

更新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)

0 个答案:

没有答案