在我的启动画面加载iphone之前的黑屏

neh*_*eha 3 iphone splash-screen

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

我甚至尝试使用[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];
}
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?

这个黑色屏幕停留约2秒钟.我在iOS4上运行它.

Thanx提前.

Tho*_*son 7

这是默认的加载行为!applicationDidFinishLaunching在应用程序完成加载之前,该方法不会运行.

克服这个问题的方法是让图片看起来Default.png像视图的大小,并调用它来显示而不是黑屏.