触摸结束事件后更新父视图控制器上 MKAnnotation 的坐标属性?

发布于 2024-08-02 04:15:43 字数 240 浏览 3 评论 0原文

我编写了一个带有可拖动注释的应用程序,并将其添加到 MKMapView 之上。 我在主视图控制器中添加了一个名为 myloc 的 CLLocationCooperative2D 变量,以便在拖动注释时存储坐标 (lat,lng) 值。 我的问题是,每当注释上的触摸结束事件结束时,如何更新超级父 UIViewController 类中的 myloc 属性值? 如果有人可以分享一些关于如何优雅地做到这一点的代码,我们将不胜感激。

谢谢

I have written an application with a draggable annotation which I have added on top of a MKMapView. I've added a CLLocationCoordinate2D variable called myloc in my main view controller to store the coordinate (lat,lng) values whenever I drag the annotation. My question is how do I update the myloc property value in the super parent UIViewController class whenever the touch end event ends on the annotation? If someone can share some code on how to do this elegantly that would be appreciated.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不奢求什么 2024-08-09 04:15:43

请查看以下博客文章: MapKit注释拖放并更新标注信息

您将找到单独的代码示例、github 上的完整项目以及对官方 Apple 文档的引用(此处是第一篇文章,无法插入第二个链接,请参阅博客文章)。

祝你好运!

Take a look at the following blog post: MapKit annotation drag and drop with callout info update.

You will find individual code samples, a full project on github and references to the official Apple Documentation (first post here, cannot insert second link, see the blog post).

Good luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文