我想设置一个搜索,当用户输入城市时,将在地图套件上放大到该城市

发布于 2024-10-10 08:24:04 字数 165 浏览 0 评论 0原文

我想设置一个搜索功能,用户可以输入搜索城市的内容,它将在地图套件上放大该城市。我已经有一个包含大量注释的地图套件和注释的表格视图。

我不认为我可以在我的注释上添加搜索,所以我可以只搜索城市,它会放大城市并显示城市中的注释吗?

Xcode 新手以及任何帮助(包括代码示例)将不胜感激!

I would like to set up a search feature that a user can type in a search for a city and it will zoom in on the city on the mapkit. I already have a mapkit with loads of annotations and a tableview of my annotations.

I don't think i can add a search on my annotations so instead, can i just search cities and it will zoom in on cities and show the annotations in the city?

New to Xcode and any help including code examples would be much appreciated !!

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

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

发布评论

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

评论(1

中性美 2024-10-17 08:24:04

我使用 Google 地理编码 API 在我的应用中启用地图搜索。此 API 返回一个边界框,以获得良好、适当的结果缩放级别。您可以使用此 + MKMapViewsetRegion:animated: 方法来显示您的结果。

希望这有帮助!

I use Google's Geocoding API to enable searching on a map in my apps. This API returns a bounding box for a good, appropriate zoom level for results. You can use this + MKMapView's setRegion:animated: method to show your result(s).

Hope this helps!

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