【问题标题】:IOS 11 - MKMapView pin dialog not clickable when another pin is behindIOS 11 - 当另一个引脚落后时,MKMapView 引脚对话框不可点击
【发布时间】:2018-08-09 17:06:47
【问题描述】:
在使用 MKMapView 时,我确实注意到了 IOS 11 上的一个问题。
当我想点击 pin 对话框中的按钮动作并且按钮动作后面有另一个 pin 时,它没有得到手势。
应该是zPosition的问题,不过不知道有没有办法只修改对话框(MKAnnotationView.annotation)的zPosition,放到引脚(MKAnnotationView.image) position前面。
对于IOS version < 11,它确实工作得很好。
有人遇到同样的问题吗?
谢谢!
【问题讨论】:
标签:
ios
swift
annotations
mkmapview
zposition
【解决方案1】:
终于找到解决办法了!
来了,如果有人需要的话:
func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
if #available(iOS 11, *) {
for annotationView in mapView.annotations {
if mapView.view(for: annotationView) == view {
mapView.view(for: annotationView)?.isUserInteractionEnabled = true
mapView.view(for: annotationView)?.becomeFirstResponder()
}
else{
mapView.view(for: annotationView)?.isUserInteractionEnabled = false
}
}
}
}
现在一切就绪!