我已经创建了一个程序来使用 IOS corelocation 框架找出我当前的位置。它工作得很好。
我需要创建一个程序,在用户携带手机旅行时列出链式店最近的分支机构。我的数据库包含带有纬度和经度的分支机构详细信息。我如何与这些详细信息进行比较以找出最近的分支机构。
非常感谢您的帮助。任何人都知道任何示例程序
谢谢, VKS
最佳答案
您可以使用 CLLocation 的 distanceFromLocation:
方法。
distanceFromLocation:
Returns the distance (in meters) from the receiver’s location to the specified location.
- (CLLocationDistance)distanceFromLocation:(const CLLocation *)location
Parameters
location The other location.
Return Value
The distance (in meters) between the two locations. Discussion
This method measures the distance between the two locations by tracing a line between them that follows the curvature of the Earth. The resulting arc is a smooth curve and does not take into account specific altitude changes between the two locations.
Availability
Available in iOS 3.2 and later.
通过此方法获取店铺与您当前位置的距离,然后您可以根据距离对列表进行排序,找到最近的分店
关于iphone - IOS Core 位置 - 查找最近的分行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6758383/