我正在尝试向我的地图添加注释。我有一个带有坐标的点数组。我正在尝试从这些坐标添加注释。
我有这个定义:
var points: [CLLocationCoordinate2D] = [CLLocationCoordinate2D]()
let annotation = MKPointAnnotation()
点里面有坐标。我检查了。我这样做:
for index in 0...points.count-1 {
annotation.coordinate = points[index]
annotation.title = "Point \(index+1)"
map.addAnnotation(annotation)
}
它只添加最后一个注释......而不是所有注释。为什么是这样?顺便说一句,有没有办法删除指定的注释,例如按标题?