ios添加 启动画面,iOS启动画面动画

本文探讨了在iOS应用中如何实现在应用程序启动时的Splash Screen动画效果,尽管UIImageView直接设置动画不生效,但作者提供了通过延迟添加自定义视图并配合动画来达成所需视觉效果的方法,适合iOS开发者参考。

In my app I want the splash screen to be animated I'm using the following code but the animation is not working.

UIImageView *splashScreen = [[UIImageView alloc] initWithImage:[UIImage imageNamed: @"Default.png"]];

[self.window.rootViewController.view addSubview: splashScreen];

[self.window makeKeyAndVisible];

NSLog(@"begin splash");

[UIView animateWithDuration: 0.2

delay: 0.5

options: UIViewAnimationOptionCurveEaseOut

animations: ^{splashScreen.alpha = 0.0;

}

completion: ^ (BOOL finished) {

[splashScreen removeFromSuperview];

NSLog(@"end splash");

}

];

解决方案

You can't animate the splash image, but you can wait until the app is launched and add your own view with an animation.