iOS应用程序打开屏幕到应用程序闪烁



我有一个iOS应用程序,它构建良好,运行良好。我已经添加了启动图像,但现在当应用程序从启动图像过渡到实际应用程序时,它会闪烁(也就是说,它们不是一个平稳的过渡)。有趣的是,我的启动屏幕与最初显示的视图相同。我如何制作我的启动图像是通过在模拟器中运行应用程序,然后进入"文件">"保存"屏幕截图,然后将它们拖到xcode中。

在我使用的一个开源类中发现了这一点

//Fade in
[UIView animateWithDuration:0.3 animations:^{
    self.alpha = 1;
}];

删除了它,现在一切都很好。

这就是我在splahscreen中使用的内容。在Appdelegate类中设置此代码。它运行平稳。

- (void)showSplashView
{
    splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.window.frame.size.width, self.window.frame.size.height)];
    splashView.image = [UIImage imageNamed:@"default.png"];
    [self.window addSubview:splashView];
    [self.window bringSubviewToFront:splashView];
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.window cache:YES];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)];
    splashView.frame = CGRectMake(-80, -80, self.window.frame.size.width+160.0, self.window.frame.size.height+160.0);
    splashView.alpha = 0.0;
    [UIView commitAnimations];
}
- (void)startupAnimationDone:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
    [splashView removeFromSuperview];
}

这里的splashView是一个简单的UIImageView,您可以使用您的图像名称来代替默认的png。

最新更新