Black screen before my splash screen loads iphone
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:spl开发者_如何学GoashScreen.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.
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.
精彩评论