-1

对于我的项目,我想在附近的位置找到/放置图钉。

4

1 回答 1

1

试试这个,

CLLocationDistance radius = 30;
CLLocation* target = [[CLLocation alloc] initWithLatitude:someLat longitude:someLon];


NSArray *locationsWithinRadius = [locations objectsAtIndexes:
                                 [locations indexesOfObjectsPassingTest:
                                  ^BOOL(id obj, NSUInteger idx, BOOL *stop) {

                                      return [(CLLocation*)obj distanceFromLocation:target] < radius;

                                  }]];

[target release];
于 2012-10-10T05:19:08.733 回答