迅捷注释图钉的标注气泡手势

  • 本文关键字:气泡 注释 ios swift
  • 更新时间 :
  • 英文 :


我正在寻找向注释引脚的标注气泡添加手势的答案。

我尝试了不同的解决方案,但它们对我不起作用。

这是最新的:

func mapView(mapView: MKMapView, didSelectAnnotationView view: MKAnnotationView{
let rightButton = UIButton(type: UIButtonType.detailDisclosure)
let gesture = UITapGestureRecognizer(target: self, action: #selector(callout(gesture:)))
rightButton.addGestureRecognizer(gesture)   
view.rightCalloutAccessoryView = rightButton
}
@objc func callout(gesture: UITapGestureRecognizer){
print("tapped")
}

正确的委托方法

func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
///
}

self.mapView.delegate = self

最新更新