我当前正在使用MapBox swift库,并且正在尝试向callout视图添加一个代理。
我试着这样做:
func mapView(_ mapView: MGLMapView, calloutViewFor annotation: MGLAnnotation) -> MGLCalloutView? {
let callout = TabletMapSearchCalloutView(representedObject: annotation, mapView: mapView)
callout.delegate = self
return callout
}但似乎有一个内部工作程序在库中运行,它将此方法后的委托设置为MGLMapView。
所以我的问题是,我如何向标注中添加一个代理,以便我可以访问点击的事件?
发布于 2018-02-26 15:49:57
所以看起来MGLMapViewDelegate有我想要的方法
func mapView(_ mapView: MGLMapView, tapOnCalloutFor annotation: MGLAnnotation)https://stackoverflow.com/questions/48983397
复制相似问题