Is there an easy way to display a sorted dropdown list on the iPhone by “closest to current location”?
I.e. if I have a list of cities with their GPS locations, can I quickly sort a dropdown to show you city selections in order of closest to you?
Will this be fast? Or will I have to presort (before you select the dropdown) in the background?
You can sort an array using one of the sortedArrayUsing… messages to your array of locations.
Assuming each of your locations is represented using a CLLocation, you can use CLLocation’s ‘getDistanceFrom:’ with the current location as the argument as part of the sort.