Problem
Given a list of known locations, show a map with the locations and zoom in to locations that lie within 25 miles of the user's location.
Solution
A view controller that contains just a MKMapView with showsUserLocation set to true, and its delegate set to the view controller. Within viewDidLoad:, i create annotations for each locations and then call showAnnotations:animated:.
When mapView:didUpdateUserLocation: gets called, i determine locations that lie within 25 miles of the user's location and update the map by creating a region centered on the user's location with a 25 mile span, and calling setRegion:animated: on the MKMapView. If no locations lie within 25 miles, the view remains the same (showing all locations).
All this works but at times there's a significant delay (several seconds) while waiting for MKMapView to acquire the user's location.
Here's the behavior i'm seeing:
When the view controller is first shown, you momentarily see the map of the whole world and then it zooms in to show all the locations. Once the user's location is acquired, which can be 1 to n seconds later, you see the map zoom in again. The "double zooming" is jarring and has the potential of leaving the user dizzy.
i could mitigate the "double zooming" by putting up a "Loading..." alert but that seems inelegant, especially if several seconds go by (which can and does happen) and the user's locations hasn't been acquired.
Does anyone have any suggestions on how i can improve the user experience? i get the feeling more can be done but i'm at a loss as to what exactly.