【发布时间】:2014-07-16 14:29:13
【问题描述】:
我有一个充满经度和纬度的数组。我的用户位置有两个双重变量。我想测试我的用户位置与我的阵列之间的距离,以查看哪个位置最近。我该怎么做?
这将获得 2 个位置之间的距离,但难以理解 我将如何针对一系列位置对其进行测试。
CLLocation *startLocation = [[CLLocation alloc] initWithLatitude:userlatitude longitude:userlongitude];
CLLocation *endLocation = [[CLLocation alloc] initWithLatitude:annotation.coordinate.latitude longitude:annotation.coordinate.longitude];
CLLocationDistance distance = [startLocation distanceFromLocation:endLocation];
【问题讨论】:
标签: ios objective-c mkmapview cllocationmanager cllocationdistance