【发布时间】: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