启动画面的splash效果

本文介绍了如何在程序启动时使用默认图片作为启动画面,并为其添加美观的Splash动画,提升用户体验和趣味性。通过实现一个简单的动画方法,使程序启动过程更加友好。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

通常我们会在自己应用中添加一个名为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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值