I have an app that launches to a tab bar controller. When the app either starts up or returns from the background it checks a server for updates to its data. If updates are available, it can take several seconds to get the data and update it.
I would like to simply present an overlay view saying to the user that the app’s data is updating and to please wait for a few seconds. The way that I am trying to do this is as follows: in my class that takes care of the updates I have:
AppDelegate *delegate = [UIApplication sharedApplication].delegate;
[delegate.tabBarController.selectedViewController.view addSubview:updatingDataView];
[self runUpdateMethods];
The problem is that the updatingDataView appears on screen only after the update methods have completed. How can I get it to appear before the updating methods start?
You need to empty into your run loop so that the views you’ve added will get drawn on the screen. Drawing on iOs is not done real time. You basically set up your drawing and exit your method, and the run loop actually draws it. So what you need to do is delay the execution of runUpdateMethods until after you’ve exited your routine. Try instead: