为iOS App增加启动动画效果


[cpp]
view plain copy
  1. -(BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:(NSDictionary*)launchOptions
  2. {
  3. self.window=[[[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]]autorelease];
  4. //Overridepointforcustomizationafterapplicationlaunch.
  5. self.viewController=[[[ViewControlleralloc]initWithNibName:@"ViewController"bundle:nil]autorelease];
  6. self.window.rootViewController=self.viewController;
  7. [self.windowmakeKeyAndVisible];
  8. UIImageView*splashScreen=[[[UIImageViewalloc]initWithFrame:self.window.bounds]autorelease];
  9. splashScreen.image=[UIImageimageNamed:@"Default"];
  10. [self.windowaddSubview:splashScreen];
  11. [NSThread sleepForTimeInterval:10.0];
  12. [UIViewanimateWithDuration:1.0animations:^{
  13. CATransform3Dtransform=CATransform3DMakeScale(1.5,1.5,1.0);
  14. splashScreen.layer.transform=transform;
  15. splashScreen.alpha=0.0;
  16. }completion:^(BOOLfinished){
  17. [splashScreenremoveFromSuperview];
  18. }];
  19. returnYES;
  20. }
  1. -(BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:(NSDictionary*)launchOptions
  2. {
  3. self.window=[[[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]]autorelease];
  4. //Overridepointforcustomizationafterapplicationlaunch.
  5. self.viewController=[[[ViewControlleralloc]initWithNibName:@"ViewController"bundle:nil]autorelease];
  6. self.window.rootViewController=self.viewController;
  7. [self.windowmakeKeyAndVisible];
  8. UIImageView*splashScreen=[[[UIImageViewalloc]initWithFrame:self.window.bounds]autorelease];
  9. splashScreen.image=[UIImageimageNamed:@"Default"];
  10. [self.windowaddSubview:splashScreen];
  11. [NSThread sleepForTimeInterval:10.0];
  12. [UIViewanimateWithDuration:1.0animations:^{
  13. CATransform3Dtransform=CATransform3DMakeScale(1.5,1.5,1.0);
  14. splashScreen.layer.transform=transform;
  15. splashScreen.alpha=0.0;
  16. }completion:^(BOOLfinished){
  17. [splashScreenremoveFromSuperview];
  18. }];
  19. returnYES;
  20. }

你可能感兴趣的:(ios)