如何在所需位置显示mapkit蓝点(用户位置)?

发布于 2024-08-08 12:31:41 字数 221 浏览 4 评论 0原文

我正在使用 MapKit。我想知道如何获取当前用户的位置。 MapKit 在当前用户位置显示一个蓝点。

我想做这样的事情:用户位置显示在地图上。我有一个按钮,再次单击时,会获取当前用户位置并在那里显示蓝点。

我需要使用 locationManager 还是只在按钮的点击事件上调用 mapView.showUserLocation=YES;

I am using MapKit. I want to know how to get current user's location. The MapKit shows a blue dot at current user location.

I want to do something like this: The user location is showed on the map. I have a button which, on clicking again, gets the current user location and shows the blue dot there.

Do I need to use locationManager or just call the mapView.showUserLocation=YES; on the button's click event?

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

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

发布评论

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

评论(1

何其悲哀 2024-08-15 12:31:41

当您想显示当前用户位置时,只需编写


[mapView setShowsUserLocation:YES];

When you want to show the current user location simply write


[mapView setShowsUserLocation:YES];

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