我在iOS 9中使用Swift。無論我選擇哪種按鈕類型,ContactAdd除外,只會呈現信息圖標。我試圖在地圖視圖中爲標註的右側獲取DetailDisclosure圖標。代碼如下:iOS - 無法在標註中獲取按鈕的詳細信息披露
let rightButton = UIButton(type: UIButtonType.DetailDisclosure);
rightButton.addTarget(self, action: "buttonTapped:", forControlEvents: UIControlEvents.TouchUpInside)
annotationView.rightCalloutAccessoryView = rightButton;
對不起。讓我提供整個方法。我相信該引腳正在被正確創建... – Darrell
'code' func mapView(mapView:MKMapView,viewForAnnotation annotation:MKAnnotation) - > MKAnnotationView? { 讓annotationView = MKPinAnnotationView(註釋:noseyesAnnotation,reuseIdentifier:標識符) annotationView.pinTintColor = noseyesAnnotation.color annotationView.canShowCallout =真 讓rightButton =的UIButton(類型:UIButtonType.DetailDisclosure); rightButton.addTarget(self,action:「buttonTapped:」,forControlEvents:UIControlEvents.TouchUpInside) annotationView.rightCalloutAccessoryView = rightButton; 'code' – Darrell
@達雷爾測試更新的代碼 –