iOS - 无法获取标注中按钮的 DetailDisclosure

iOS - Cannot get a DetailDisclosure for a button in the callout

我正在使用 Swift 和 iOS 9. 无论我 select 是什么按钮类型,除了 ContactAdd,只呈现信息图标。我正在尝试为地图视图中标注的右侧获取 DetailDisclosure 图标。这是代码:

    let rightButton = UIButton(type: UIButtonType.DetailDisclosure);
    rightButton.addTarget(self, action: "buttonTapped:", forControlEvents: UIControlEvents.TouchUpInside)
    annotationView.rightCalloutAccessoryView = rightButton;

您创建图钉了吗?尝试将按钮 .DetailDisclosure 添加到 pinView

var pinView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId) as? 
pinView!.rightCalloutAccessoryView = UIButton.buttonWithType(.DetailDisclosure) as UIButton

更新 这对我有用

let identifier = "pin"
var view: MKPinAnnotationView
view = MKPinAnnotationView(annotation: annotation, reuseIdentifier: identifier)
view.canShowCallout = true
view.calloutOffset = CGPoint(x: -5, y: 5)
view.rightCalloutAccessoryView = UIButton(type: .DetailDisclosure) as UIView
@user2893289
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView?
 {
    let annotationView = MKPinAnnotationView(annotation: noseyesAnnotation, reuseIdentifier: "pin")
    annotationView.pinTintColor = noseyesAnnotation.color
    annotationView.canShowCallout = true
    let rightButton = UIButton(type: UIButtonType.DetailDisclosure);
    annotationView.rightCalloutAccessoryView = rightButton;
    return annotationView
}