我目前正在使用 MapBox
swift 库,并且正在尝试向标注 View 添加委托(delegate)。
我正在尝试这样做:
func mapView(_ mapView: MGLMapView, calloutViewFor annotation: MGLAnnotation) -> MGLCalloutView? {
let callout = TabletMapSearchCalloutView(representedObject: annotation, mapView: mapView)
callout.delegate = self
return callout
}
但似乎有一个内部工作人员在库中运行,该工作人员在此方法之后将委托(delegate)设置为 MGLMapView
。
所以我的问题是,如何向标注添加委托(delegate)以便我可以访问点击的事件?
最佳答案
看来MGLMapViewDelegate
有我正在寻找的方法
func mapView(_ mapView: MGLMapView, tapOnCalloutFor annotation: MGLAnnotation)
关于ios - 将委托(delegate)添加到 CalloutView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48983397/