让整个界面呈现水波纹的效果

 1 #import "AppDelegate.h"
 2 #import <QuartzCore/QuartzCore.h>
 3 
 4 @interface AppDelegate ()
 5 @property (nonatomic ,strong)UIImageView *birdImage;
 6 @end
 7 
 8 @implementation AppDelegate
 9 
10 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
11     self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
12     // Override point for customization after application launch.
13     self.window.backgroundColor = [UIColor whiteColor];
14     // 创建UIImageView
15     self.birdImage = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
16     //设置UIImageView可以操作
17     self.birdImage.userInteractionEnabled = YES;
18     // 添加图片
19     self.birdImage.image = [UIImage imageNamed:@"bird"];
20     // 轻拍手势
21     UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAntion)];
22     // 给UIImageView添加手势
23     [self.birdImage addGestureRecognizer:tap];
24     [self.window addSubview:self.birdImage];
25  
26     [self.window makeKeyAndVisible];
27     return YES;
28 }
29 
30 - (void)tapAntion
31 {
32     // 创建动画
33     CATransition *anim = [CATransition animation];
34     //设置代理
35     anim.delegate = self;
36     // 设置动画时间
37     anim.duration = 1.5;
38     //水波效果,让整个界面呈现水波纹的效果(私有API,没有列入官方API)
39     anim.type = @"rippleEffect";
40     [[self.birdImage layer] addAnimation:anim forKey:@"rippleEffect"];
41 }
42 
43 @end

 

转载于:https://www.cnblogs.com/lantu1989/p/4603505.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值