我有一张带有2个注释的地图,并且我需要2个不同的图像给他们每个人。如何使用Swift将图像更改为MKAnnotation
我知道如何做一个注释,但我的问题是有两个注释。
这里是我的代码之一:
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
let reuseId = "pin"
var anView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId)
anView = MKAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
anView!.image = nil;
anView!.image = UIImage(named:"destinationPin")
return anView
}
而且如果任何人都可以,如果你给我解释一下什么是reuseId我会很感激。
在此先感谢
你是什么意思两个注释?两个单独的课程? – sdasdadas
我在地图上有两个针,我希望他们每个人都有不同的图像 –