从 mkmapview 中窃取两指平移
我在 MKMapView 上方放置了一个 UIview,目的是在跟踪用户位置时从地图视图中窃取两指平移。如果您注意到谷歌地图应用程序也在手机上执行此操作。
但我不知道该怎么做。我希望能够根据位置是否被跟踪来随意启用和禁用它。所有其他手势和触摸都应传递到地图视图上,
提前致谢。
I've placed a UIview above an MKMapView with the intention of stealing the two-finger pan from the map view when I am tracking a user's location. If you notice Google maps app does this on the phone as well.
But I'm at a loss as to how to do it. I want to be able to enable it and disable it at will depending on whether the location is being tracked or not. All other gestures and touches should be passed onto the mapview
thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您要使用 OS 4 及更高版本,最简单的方法是不使用 UIView,而是直接在地图视图上添加手势识别器,例如:
...然后所有滑动手势(在这种情况下)都会传递给 [self handlePanGesture:(UIPanGestureRecognizer*) x];
如果您查看有关手势识别器的文档,就会发现有各种各样的选项,您可以将它们添加到相当精细的粒度(点击与滑动、使用了多少根手指等)
Assuming you're going for OS 4 and above, the easy way is NOT to use a UIView, but instead to add a gesture-recognizer directly onto the mapview, e.g.:
...and then all swipe gestures (in that case) would get passed to [self handlePanGesture:(UIPanGestureRecognizer*) x];
If you look in the docs around gesture recognizers, there's a wide variety of options, and you can add them to a pretty fine-level of granularity (tap vs swipe, how many fingers used, etc)