iOS-CALayer动画之CAKeyframeAnimation动画视图的添加点击事件和气泡随机飘动上升动画
@property (strong, nonatomic) UIView *bgView;//气泡所在的view
-(void)viewDidLoad {
self.bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
self.bgView.userInteractionEnabled = YES;
[self.view addSubview:self.bgView];
//动画循环生成气泡
[[NSRunLoop currentRunLoop] addTimer:[NSTimer scheduledTimerWithTimeInterval:0.1
target:self
selector:@selector(createBubble)
userInfo:nil
repeats:YES] forMode:NSRunLoopCommonModes];
}
//路径动画之气泡从底部随机飘动上升
-(void)createBubble {