iPhone上实现Default.png动画
来源:互联网 发布:手机网页广告过滤 知乎 编辑:程序博客网 时间:2024/05/17 20:28
原理: 添加一张和Default.png一样的图片,对这个图片进行动画,从而实现Default动画的渐变消失的效果。 操作: 在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions中添加如下代码: // Make this interesting. UIImageView *splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)]; splashView.image = [UIImage imageNamed:@"Default.png"]; [self.window addSubview:splashView]; [self.window bringSubviewToFront:splashView]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:2.0]; [UIView setAnimationTransition:UIViewAnimationTransitionNone forView: self.window cache:YES]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)]; splashView.alpha = 0.0; splashView.frame = CGRectMake(-60, -85, 440, 635); [UIView commitAnimations]; 就ok了