在使用MKMapView时,我注意到IOS 11上存在问题。
当我想从pin对话框中单击按钮操作并且按钮操作后面有另一个引脚时,它不会获得该手势。
它应该是关于zPosition的东西,但我不知道是否有任何方法可以修改对话框zPosition
的(MKAnnotationView.annotation)
并将其放在引脚(MKAnnotationView.image) position
前面。
对于IOS version < 11
来说,它确实很有效。
有人遇到同样的麻烦吗?
谢谢!
最后我找到了解决方案!
如果有人需要它,它来了:
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
}
}
}
}
一切都井然有序!