2つの注釈を持つ地図があり、それぞれに2つの異なる画像が必要です。SwiftでMKAnnotationに画像を変更するには
私は1つの注釈でそれを行う方法を知っていますが、私の問題は2つの注釈です。
は、ここに1つのために私のコードです:
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あるものを私に説明している場合、誰もが、私は本当に感謝することができた場合
。事前におかげ
2つのアノテーションをどういう意味ですか? 2つの別々のクラス? – sdasdadas
私はマップ上に2つのピンを持っていて、それらのそれぞれに別のイメージを持たせたいと思っています。 –