I allow the user to manage records on other views. I set a flag if certain changes are made.
Then on the flag (where the data changes will have an impact) I run some methods / queries which create the data which is used in my table view(s). This workload currently happens in viewWillAppear(s).
This could take a few seconds and I’d like to show my progress indicator view which I wrote today, it uses a transparent view with a activity indicator in the center of the view.
[self performSelectorInBackground:@selector(startupStuff) withObject:sender];
However, viewWillAppear won’t wait while I run the the work in the background.
Ideally I’m looking for a quick fix to work around this problem.
Any ideas ?
That’s the whole point of it, isn’t it? At the end of your
startupStuffmethod, you should call another method on the main thread (withperformSelectorOnMainThread:...) that is used to (a) inform the controller that your data is ready, (b) reload the table view and (c) dismiss your progress indicator view.