I am working with MapKit and annotations in iOS. Right before the annotations are added (which can take a while), I would like to display a small “Loading…” UIView. If I do this without threading, the loading view lags so much that it barely appears before it’s dismissed. If I use performSelectorInBackground to load the annotations, it will work every few tries and the rest of the UIView will appear but no annotations, even though mapView:didAddAnnotationViews: is called. Can anyone think of why this would be behaving so unpredictably?
This is how I’m calling it, if it helps:
[self performSelectorInBackground:@selector(refreshAnnos) withObject:nil];
You can load the annotations on the background, but you should always ADD them on the main thread.
That is why
is called, but does not propagate to the UI. It would be the same as calling the UITableViewDelegate methods in the background.
You could possibly try the following design pattern using GCD