Guest User

Untitled

a guest
May 7th, 2016
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. - (void)locationManager:(CLLocationManager *)manager
  2.  
  3. didUpdateLocations:(NSArray *)locations {
  4.  
  5. // If it's a relatively recent event, turn off updates to save power
  6. NSLog(@"%@ locations",locations);
  7.  
  8. float Lat = _locationManager.location.coordinate.latitude;
  9. float Long = _locationManager.location.coordinate.longitude;
  10.  
  11. NSLog(@"Lat : %f Long : %f",Lat,Long);
  12.  
  13. CLLocationCoordinate2D center = CLLocationCoordinate2DMake(28.52171,77.2015457);
  14.  
  15. NSLog(@"center check %@",center);
  16. CLCircularRegion *region = [[CLCircularRegion alloc] initWithCenter:center
  17. radius:500
  18. identifier:@"new region"];
  19. BOOL doesItContainMyPoint = [region containsCoordinate:CLLocationCoordinate2DMake(Lat,Long)];
  20.  
  21. NSLog(@"success %hhd", doesItContainMyPoint);
  22.  
  23. }
  24.  
  25. the issue is ,here i m providing a static region for which i m checking (center)
  26. but the requirement is, this region will take the lat n long of the riders and riders can vary in number
  27.  
  28. i hv all lat n long in an array of dictionary. First the driver at pick the first rider in the list and at that time i need the region of rider 1 location.
  29. I m not getting any idea how to achieve this
  30.  
  31. if i do like this
  32. for (NsMutableDictionary * dict in goersList)
  33. {
  34. rider_id=[dict valueForKey:@"trip_id"];
  35. lat=[dict valueForKey:@"origin_lat"];
  36. longi=[dict valueForKey:@"origin_long"];
  37.  
  38. }
  39. then how will it knw that the first region is to be monitered and after existing from that range i hv to checkfor second location
Add Comment
Please, Sign In to add comment