1
爲了放置個人圖片而不是傳統紅色徽章,應該寫些什麼?更改圖片徽標地圖
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
if annotation is MKUserLocation {
return nil
}
let annView : MKPinAnnotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "currentloc")
annView.pinTintColor = UIColor.redColor()
annView.animatesDrop = true
annView.canShowCallout = true
annView.calloutOffset = CGPointMake(-8, 0)
annView.autoresizesSubviews = true
annView.rightCalloutAccessoryView = UIButton(type: UIButtonType.DetailDisclosure) as UIView
return annView
}
annotationIdentifier它給了我錯誤。我將其替換爲:字符串:「隨機詞」 –
是的,使用任何獨特的功能標識引腳的性質。對不起,如果我的意圖不清楚。我調整了上面的代碼示例。 – Rob
謝謝:)友好和樂於助人 –