手势 UISwipeGestureRecognizer 轻扫手势(uiswipegesturerecog,手势,轻扫手势,开发技术)

时间:2024-05-05 03:00:11 作者 : 石家庄SEO 分类 : 开发技术
  • TAG :

    %E6%89%8B%E5%8A%BF++UISwipeGestureRecognizer+%E8%BD%BB%E6%89%AB%E6%89%8B%E5%8A%BF




UISwipeGestureRecognizer * swipeGesture = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeGesture:)];


轻扫方向
UISwipeGestureRecognizerDirectionRight
UISwipeGestureRecognizerDirectionLeft
UISwipeGestureRecognizerDirectionUp
UISwipeGestureRecognizerDirectionDown


设置轻扫方向,让左右方向都存在 只要枚举值中又左移运算符,代表枚举值可以通过按位或 | 让多个枚举值存在

warning :::::上下 和左右方向 在一个手势识别器中不能同时存在

如果想要上下左右四个方法都有,就要创建两个轻扫手势对象,一个支持上下,一个支持左右.

swipeGesture.direction = UISwipeGestureRecognizerDirectionLeft | UISwipeGestureRecognizerDirectionRight ;

[redView addGestureRecognizer:swipeGesture];

[swipeGesture release];



- (void)swipeGesture :(UISwipeGestureRecognizer *)swipeGesture
{
NSLog(@"%u", swipeGesture.direction);
swipeGesture.view.backgroundColor = [UIColor random];
}




本文:手势 UISwipeGestureRecognizer 轻扫手势的详细内容,希望对您有所帮助,信息来源于网络。
上一篇:线程 NSThread 创建线程下一篇:

10 人围观 / 0 条评论 ↓快速评论↓

(必须)

(必须,保密)

阿狸1 阿狸2 阿狸3 阿狸4 阿狸5 阿狸6 阿狸7 阿狸8 阿狸9 阿狸10 阿狸11 阿狸12 阿狸13 阿狸14 阿狸15 阿狸16 阿狸17 阿狸18