为iOS App增加启动动画效果

来源:互联网 发布:wind万德数据库 编辑:程序博客网 时间:2024/05/01 16:03

[cpp]
 view plaincopy
  1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions  
  2. {  
  3.     self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];  
  4.     // Override point for customization after application launch.  
  5.     self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];  
  6.     self.window.rootViewController = self.viewController;  
  7.     [self.window makeKeyAndVisible];  
  8.       
  9.     UIImageView *splashScreen = [[[UIImageView alloc] initWithFrame:self.window.bounds] autorelease];  
  10.     splashScreen.image = [UIImage imageNamed:@"Default"];  
  11.     [self.window addSubview:splashScreen];  
  12.      [NSThread sleepForTimeInterval:10.0];
  13.     [UIView animateWithDuration:1.0 animations:^{  
  14.         CATransform3D transform = CATransform3DMakeScale(1.5, 1.5, 1.0);  
  15.         splashScreen.layer.transform = transform;  
  16.         splashScreen.alpha = 0.0;  
  17.     } completion:^(BOOL finished) {  
  18.         [splashScreen removeFromSuperview];  
  19.     }];  
  20.       
  21.     return YES;  
  22. }  
原创粉丝点击