gpt4 book ai didi

ios - 隐藏 MKAnnotationView Swift

转载 作者:行者123 更新时间:2023-11-28 06:36:24 25 4
gpt4 key购买 nike

我正在尝试使用以下代码以编程方式调用 mapView(mapView: MKMapView, didDeselectAnnotationView view: MKAnnotationView) 函数:

dispatch_async(dispatch_get_main_queue()) {
for item in self.largeMapView.selectedAnnotations {
self.largeMapView.deselectAnnotation(item, animated: false)
}
}

但这并没有做任何事情。如果我在 map 上按下,它就会被调用,但我希望它在不需要按下的情况下被调用。

最佳答案

不太确定为什么,但这段代码似乎完整地解决了问题:

dispatch_async(dispatch_get_main_queue()) {
for item in self.largeMapView.selectedAnnotations {
self.largeMapView.deselectAnnotation(item, animated: false)
}
myView.pinTintColor = UIColor.greenColor()
calloutView.hidden = true
}

手动将 pinTintColor 更改为“取消选择”,并手动隐藏 calloutView 解决了问题。

关于ios - 隐藏 MKAnnotationView Swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38982731/

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