我尝试使用以下代码以编程方式调用mapView(mapView: MKMapView, didDeselectAnnotationView view: MKAnnotationView)函数:
dispatch_async(dispatch_get_main_queue()) {
for item in self.largeMapView.selectedAnnotations {
self.largeMapView.deselectAnnotation(item, animated: false)
}
}但这并不能做任何事情。如果我按下地图,它将被调用,但我希望无需按键即可调用它。
发布于 2016-08-18 03:59:13
不知道为什么,但是完整的代码似乎解决了这个问题:
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解决了问题。
https://stackoverflow.com/questions/38982731
复制相似问题