gpt4 book ai didi

ios - 将委托(delegate)添加到 CalloutView

转载 作者:行者123 更新时间:2023-11-30 11:44:29 25 4
gpt4 key购买 nike

我目前正在使用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com