我在 iOS 9 中使用 Swift。无论我选择什么按钮类型,除了 ContactAdd 之外,都只会呈现信息图标。我正在尝试为 map View 中标注的右侧获取 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
关于iOS - 无法获取标注中按钮的 DetailDisclosure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33989532/