You can not. The application must be running before you can display any dynamic content. After loading the first ViewController, you can, of course, display a progress bar and load. Prior to this, you can only show the static image Default.png and Default@2x.png. If you delay intensive loading after completing your method -[ViewController viewDidLoad], you can display any graphical interface when doing heavy work.
Edit: In this example, the new thread in your DidLoad view will be disconnected and do the hard work (in this case, sleep for 1 second) and update UIProgressViewand record the progress when it sleeps 10 times, increasing the execution time to 0.1 each time.
- (void)viewDidLoad
{
[NSThread detachNewThreadSelector:@selector(workerBee) toTarget:self withObject:nil];
}
- (void)workerBee
{
NSAutoreleasePool* workerPool = [[NSAutoreleasePool alloc] init];
for (float i = 0; i<1; i+= 0.1)
{
[self performSelectorInBackground:@selector(updateProgress:) withObject:[NSNumber numberWithFloat:i]];
sleep(1000);
}
[workerPool release];
}
- (void)updateProgress:(NSNumber*)number
{
NSLog("Progress is now: %@", number);
[progressView setProgress:[number floatValue]];
}
source
share