此代碼用於初始化註釋視圖,但右側附件視圖在地圖中不可見。無法顯示快速註釋的左側附件視圖
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
var view = mapView.dequeueReusableAnnotationView(withIdentifier: "Map")
if view == nil {
view = MKAnnotationView(annotation: annotation, reuseIdentifier: "Map")
view?.canShowCallout = true
let btn = UIButton(type: .detailDisclosure)
view?.rightCalloutAccessoryView = btn
}
view?.annotation = annotation
return view
}
我不知道是什麼問題。
您使用的是'rightCalloutAccessoryView'並請求離開 –
感謝您指出。 @SachinVas –
@RohitDulam當您點擊/選擇註釋時,會顯示'CalloutAccessoryView'。 –