2010-09-21 82 views
2

在我的应用程序中出现了一个奇怪的问题,它在加载我的启动画面之前显示黑屏一段时间。这个黑屏并不是由于任何正在进行的操作,因为我正在加载我的splashscreen,然后开始我的XML解析任务。我的启动画面加载之前的黑屏iphone

我甚至尝试过使用[window makeKeyAndVisible];但徒劳无功。

这我的代码:

- (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]; 
} 

任何人可以请帮助?

此黑屏停留约2秒钟。我在iOS4上运行它。

Thanx提前。

回答

6

这是默认的加载行为! applicationDidFinishLaunching方法不会运行,直到应用程序FINISHED LOADING完成。

解决这个问题的方法是将图片的大小视为Default.png而不是黑屏。