如何在appDelegate中刷新MKMapView

发布于 2024-10-09 08:18:20 字数 228 浏览 0 评论 0原文

最初,当我学习如何编写多视图应用程序时,我发现了这种重新加载 UITableView

[randomTableView reloadData] 的便捷方法;

但是当我想重新加载 MKMapView 时,我该怎么做呢?场景是这样的:

我选择一个地址并加载地图(命中所有常用的控制器方法 - 生活很美好) 接下来我“返回”并单击另一个地址(但地图仍然显示以前的位置)

提前谢谢您!

Initially when I learned how to write a multi view application I found this handy way to reload the UITableView

[randomTableView reloadData];

But when I want to reload an MKMapView how would I do this exactly? The scenario is this:

I pick an address and the map loads (hits all the usual controller methods - life is good)
Next I go "back" and click another address (yet the map is still showing the previous location)

Thank you in advance!

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

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

发布评论

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

评论(1

禾厶谷欠 2024-10-16 08:18:20

您必须设置 MKMapView 的中心坐标 (setCenterCoordinate:animated:) 或其区域 (setRegion:animated:)。您可能已经在第一次调用地图时执行了此操作 - 您只需要再次执行此操作。

You have to set the MKMapView's center coordinate (setCenterCoordinate:animated:) or its region (setRegion:animated:). You probably do it already with the first call to the map -- you'll just need to do it again.

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