手势 UIGestureRecognizer 轻拍手势
UITapGestureRecognizer * tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTapGesture:)];
tapGesture.numberOfTapsRequired = 1; //设置轻拍的次数
设置轻拍时手指的个数
tapGesture.numberOfTouchesRequired = 2;
[redView addGestureRecognizer:tapGesture];// 给视图添加手势
[tapGesture release];
轻拍事件
- (void)handleTapGesture :(UITapGestureRecognizer *)tapGesture
{
tapGesture.view.backgroundColor = [UIColor random];
}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。