Today I have write about to getting particular area.
First getting the list of location save into array and passed this array to below function
01 | -(NSArray *)findNearMe:(NSArray *)lounges { |
02 | NSMutableArray *arNearme = [NSMutableArray array]; |
04 | CLLocation *currentLocation; |
06 | for(NSDictionary *d in lounges) |
08 | if([[LocationController sharedInstance] locationKnown] == YES) |
10 | currentLocation = [[LocationController sharedInstance] currentLocation]; |
14 | currentLocation = [[CLLocation alloc] initWithLatitude:29.33891 longitude:48.077202]; |
18 | CGFloat latitude=[[d valueForKey:@"latitude"] floatValue]; |
19 | CGFloat longitude=[[d valueForKey:@"longitude"] floatValue]; |
20 | CLLocation *newPinLocation=[[CLLocation alloc] initWithLatitude:latitude longitude:longitude]; |
21 | double distanceValue=[currentLocation distanceFromLocation:newPinLocation]; |
23 | if(distanceValue/1000.0<=DISTANCE_RADIUS) { |
25 | [arNearme addObject:d]; |
Cheers!!
No comments:
Post a Comment