淘先锋技术网

首页 1 2 3 4 5 6 7

通常我们会在自己应用中添加一个名为Default.png的图片作为启动画面,这样做可以在我们程序启动加载时给用户一个友好的体验!

同样我们可以给这个启动画面添加一个漂亮的Splash动画效果,这样会给用户带来更好的体验及趣味性!

- (void)splashWithImageView:(UIImageView *)imageView {

  imageView.hidden = YES;

  CATransition *animation = [CATransition animation];

  animation.delegate = self;
    animation.duration = 2.0f;
      animation.timingFunction = UIViewAnimationCurveEaseInOut;
      animation.fillMode = kCAFillModeForwards;
      animation.type = kCATransitionFade; // @"rippleEffect", @"pageCurl";
      animation.subtype = kCATransitionFromLeft;

  [imageView.layer addAnimation:animation forKey:@"animation"];

}

我们只需要在程序启动时调用这个方法即可:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 480.0)];
    imageView.image = [UIImage imageNamed:@"Default.png"];
    self.loginView = imageView;
    [self.window addSubview:imageView];
    [imageView release];

    [self performSelector:@selector(splashWithImageView:) withObject:imageView afterDelay:0.0];
}

转载于:https://www.cnblogs.com/OtionSky/archive/2012/05/16/Default_Splash.html