如何获取 iPhone 中的当前位置
我正在 iPhone 中集成谷歌地图。我必须显示地图中显示的当前位置。我如何获得当前位置?
谢谢
I am making google map integration in iphone. I have to show current location showing in map. How will i get current location ?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在以下文章中搜索
访问设备的当前位置
:MKMapView 类参考
MapView.showsUserLocation = YES;
)相关 SO 帖子:
Search for
Accessing the Device’s Current Location
in following article:MKMapView Class Reference
MapView.showsUserLocation = YES;
)Related SO posts:
我认为问题已经得到解答 -
将其放在
viewdidappear:animated
中,然后您应该发现您拥有正确的位置。早点做的话,位置还没有确定,你可能最终会进入海洋:)
I think the question has been answered -
place this in the
viewdidappear:animated
then you should find that you have the right location. Doing it any sooner and the location won't be set yet and you'll probably end up in the ocean :)
简短的答案是编写类似
mapview.showsUserLocation = YES;
的代码,其中 mapview 是您的 UIMapView 类对象。The short answer is to write code like
mapview.showsUserLocation = YES;
, where mapview is your UIMapView class object.