按距离过滤地图注释

时间:2014-09-12 02:25:59

标签: ios ios7 dictionary xcode5 mkannotation

我需要一些过滤器的帮助。我如何实现一个算法,过滤掉用户位置半径内的相关地图注释,非常感谢!任何反馈表示赞赏!谢谢你,祝你有个愉快的一天。

到目前为止我的代码:

CLLocationCoordinate2D coordinates;
CLLocationDistance test = 1000; // set distance
coordinates.latitude = [[row objectForKey:@"latitude"] doubleValue];// get user's latitude
coordinates.longitude = [[row objectForKey:@"longitude"] doubleValue];

MapAnnotation *annotation = [[MapAnnotation alloc] initWithCoordinate:coordinates title:titles subtitle:contents image:[row objectForKey:@"image"]]; // specify annotation's detail

[self.mapView addAnnotation:annotation];// adding annotation into the map
[annotation release];

0 个答案:

没有答案