iphone - IOS Core 位置 - 查找最近的分行

标签 iphone ios gps

我已经创建了一个程序来使用 IOS corelocation 框架找出我当前的位置。它工作得很好。

我需要创建一个程序,在用户携带手机旅行时列出链式店最近的分支机构。我的数据库包含带有纬度和经度的分支机构详细信息。我如何与这些详细信息进行比较以找出最近的分支机构。

非常感谢您的帮助。任何人都知道任何示例程序

谢谢, VKS

最佳答案

您可以使用 CLLocationdistanceFromLocation: 方法。

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/

相关文章:

ios - 为什么 Xamarin Forms Activity Indicator 不会在 iOS 上呈现?

JAVA - GPS 接收器在控制台中发送奇怪/编码的帧

java - 除非 GPS 开启,否则融合位置提供程序无法获取位置

iphone - 当我为 UITableView 设置 rowHeight 时,单元格的高度不应该也改变吗?

iphone - 在Objective c中将NSData转换为NSString

ios - 如何使用 swift 比较核心数据中同一实体的两个属性值

ios - 构建步骤 'Xcode' 将构建标记为失败 - Jenkins iOS

matlab - Matlab 中的 GPS 区域选择

ios自动布局标签定位

ios - 在 Storyboard 中添加了 UIScrollView 和 UIImageView - 图像被压扁并且不滚动