简体   繁体   English

MKAnnotationView从MKMapView窃取触摸

[英]MKAnnotationView stealing touches from MKMapView

I have a map view with lots of custom annotations. 我有一个带有很多自定义注释的地图视图。 The problem is that there are so many of them that you're very likely to hit an annotation when you're trying to zoom. 问题在于它们太多了,以至于在尝试缩放时您很可能会碰到注释。 The annotation steals the touch and you're unable to zoom. 注释会窃取触摸,您将无法缩放。

I would like it to work like a table view: When you start dragging, the cell is deselected and the table view starts scrolling. 我希望它像表格视图一样工作:开始拖动时,取消选择单元格,表格视图开始滚动。 Does anyone know how to accomplish this with MKMapView ? 有谁知道如何使用MKMapView完成此操作?

If not, is there some third party map view which does what I want? 如果没有,我需要什么第三方地图视图?

Since zoom requires multiple touches why not check for that versus a tap? 由于缩放需要多次触摸,所以为什么不先检查一下又要点击一下呢? Add to that something where you can decide when to kill competing gestures such as the touch point being within the frame of one of your subclassed annotation views: 另外,您可以决定何时取消竞争性手势,例如触摸点位于子类化注释视图之一的框架内:

gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer)

How are you detecting touches on the pins? 您如何检测引脚上的接触? If you are using the standard map view delegate callbacks then it should take care of this issue for you. 如果您使用标准的地图视图委托回调,那么它应该为您解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM