views:

38

answers:

1

Hi all,

There is a strange problem occured in my application in which it's showing a black screen for a bit of time before it loads my splashscreen. This black screen is not due to any ongoing operation as I am loading my splashscreen first and then starting my xml parsing task.

I even tried using [window makeKeyAndVisible];, but in vain.

This' my code:

- (void)applicationDidFinishLaunching:(UIApplication *)application {    

comingFromLogin = NO;
//Check For Internet
gotInternet = [self checkInternet]; //Test for Internet, calling the self method

if ( gotInternet == 0) {
    //I have no internet
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Sorry No Network Available" message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    [alert release];
    //  internetIcon.hidden = NO;

} else {
    //I do have internet

    [self didLoadSplashScreen];
 }
}

-(void)didLoadSplashScreen{

activity_indicator = [[ActivityIndicator alloc] initWithNibName:@"ActivityIndicator" bundle:nil];

splashScreen = [[splashScreenView alloc]initWithNibName:@"splashScreenView" bundle:nil];

splashScreen.view.alpha = 1.0;
splashScreen.view.frame = CGRectMake(0, 20, 320, 480);
[window addSubview:splashScreen.view];
[window addSubview:activity_indicator.view];

[window makeKeyAndVisible];

[self disappearSplashScreen];
}

Can anybody please help?

This black screen stays for about 2 seconds. I'm running it on iOS4.

Thanx in advance.

+2  A: 

That's the default loading behavior! The applicationDidFinishLaunching method isn't run until the application FINISHED LOADING.

The way to overcome this is to have a picture the size of the view and call it Default.png that will show instead of the black screen.

Thomas Clayson