【问题标题】:Black screen before my splash screen loads iphone在我的初始屏幕加载 iphone 之前出现黑屏
【发布时间】:2010-09-21 10:55:27
【问题描述】:

在我的应用程序中出现了一个奇怪的问题,它在加载我的启动画面之前显示了一段时间的黑屏。这个黑屏不是由于任何正在进行的操作,因为我首先加载我的启动画面,然后开始我的 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];
}

有人可以帮忙吗?

此黑屏持续约 2 秒。我在 iOS4 上运行它。

提前感谢。

【问题讨论】:

    标签: iphone splash-screen


    【解决方案1】:

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

    解决这个问题的方法是有一个视图大小的图片并将其命名为Default.png,它将显示而不是黑屏。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-18
      • 2020-01-07
      • 2016-01-04
      • 2022-11-14
      • 1970-01-01
      • 2015-08-01
      • 1970-01-01
      相关资源
      最近更新 更多