i have created an application which show data from user current location. I want to sort them in assending order on the base of minimum distance found of the user. I know that i need to use this kind of function:
[userLocationd istanceFromLocation:cameraLocation];
But, what do i do after that? I should sort everyone after distance and putting them in an array, but how do i rearrange every cell then according to minimum location get of the user? (cellForRowAtIndexPath)
Also; i havent really figured out how to find the users location. I am on that, but it would be helpful if someone pointed me in the right direction.
How to sort the array to min distance to maximum location?
i have used this code.
CLLocation *location1 = [[[CLLocation alloc] initWithLatitude:someLatitude longitude:someLongitude] autorelease];
CLLocation *location2 = [[CLLocation alloc] initWithLatitude:coordinate.latitude longitude:coordinate.longitude];
float target = [location2 distanceFromLocation:location1];
target = target / 1000;
Thanks in advance!