通过 MKMapView 上的用户交互创建叠加层?
我有两个问题,
如何根据用户的触摸事件在 MKMapkitView 上创建叠加层?即为了简单起见,用户触地并创建一个 MKCircle 叠加层
地图应用程序如何在触地时实现“掉落的图钉”?有人知道或有一些关于如何完成类似事情的代码示例吗?
任何指示将不胜感激。正如你所看到的,我一直在谷歌上搜索并阅读大量文档,但没有取得多大成功。
I have two questions,
How to create an overlay on a MKMapkitView from user's touch down events? i.e. To keep it simple, the user touches down and it creates a MKCircle overlay
How does the Maps application implements the "dropped pin" on touch down? Anybody knows or have some code examples on how to accomplish something similar?
Any pointers would be greatly appreciated. I've been googling and reading lots of docs without much success as you can see.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
下面的示例创建了一个圆圈,并在用户触摸并按住手指 1 秒的地方放置了一个图钉。它使用 UILongPressGestureRecognizer,在地图初始化的任何地方(例如 viewDidLoad)都会将其添加到 mapView 中。
确保还设置了mapView 的委托。
Below is an example that creates a circle and drops a pin where the user touches and holds their finger for 1 second. It uses a UILongPressGestureRecognizer which is added to the mapView wherever the map is initialized (eg. viewDidLoad).
Make sure the mapView's delegate is set also.