Reputation: 933
My app performs time-consuming one-time initialization in didFinishLaunchingWithOptions. I would like to display an alert, UIAlertView, to inform the user about this condition, but the alert never shows up until didFinishLaunchingWithOptions completes, even if shown with [alert performSelector:@selector(show) withObject:nil afterDelay:0.0];
.
Moving one-time initialization to post- didFinishLaunchingWithOptions is not possible, due to the fact that didFinishLaunchingWithOptions has to set the main window's root view controller, which needs the initialization. Setting up a throw-away (dummy) root view controller in didFinishLaunchingWithOptions, covered or replaced later, seems somewhat... inelegant.
Ideas?
Upvotes: 1
Views: 633
Reputation: 572
I've had this problem before, with one particular app.
The only way to solve it is with a "dummy" root view controller.
What I've done was to make a view controller with a UIImageView
, add that UIImageView
the launch image and an activity indicator.
Note that an activity indicator don't have to be a UIActivityIndicatorView
; activity indicator is just a concept.
In my case I had a label and a progress bar. I would update the progress bar trough out the loading process, and change the label text to indicate the user what the app was doing.
Also, I advise you not to use the alert view; it's to intrusive.
Upvotes: 1