显示当前位置周围的位置?
在我的地图中,我需要显示我从 xml 获取的位置,这些位置当前位于距我当前位置 200 英里的半径内。 我以前从来没有做过这件事,你能建议一个方法吗?
谢谢,
In my map i need to display the locations which i am getting from a xml which are currently in a 200 mile radius from my current location.
I have never done this thing before can you please suggest a way.
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看 核心位置。特别是,
CLLocation
类的distanceFromLocation:
方法对于查找附近位置非常有用。使用CLLocationManager
找出当前位置。由于您很可能会从 XML 中检索纬度和经度,因此
CLLocation
的initWithLatitude:longitude:
将可以方便地初始化您可以使用的CLLocation
对象。稍后传递给distanceFromLocation:
。Look into CoreLocation. Particularly, the method
distanceFromLocation:
of theCLLocation
class will prove useful to find nearby locations. UseCLLocationManager
to find out the current location.Since you will most likely retrieve latitudes and longitudes from your XML,
CLLocation
sinitWithLatitude:longitude:
will be handy to initializeCLLocation
objects that you can later pass todistanceFromLocation:
.这将是您访问过的最好的网站 http://www.raywenderlich.com/2847/introduction-to-mapkit-on-ios-tutorial" rel="nofollow"> raywenderlich.com/2847/introduction-to-mapkit-on-ios-tutorial
This will be the best site you ever visit http://www.raywenderlich.com/2847/introduction-to-mapkit-on-ios-tutorial