IOS中的六大手势
来源:互联网 发布:剑三眼睛捏脸数据 编辑:程序博客网 时间:2024/06/05 07:42
/*六大手势:1.轻拍,单击,双击,多指点击 2.长按 3.轻扫,分上下左右四个方向 4.旋转
5.捏合,放大缩小 6.拖拽,移动位置 */
UIView *aView = [[UIView alloc] initWithFrame:CGRectMake(30, 30, 280, 280)];
aView.backgroundColor = [UIColor orangeColor];
[self.view addSubview:aView];
[aView release];
//轻拍手势
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(changeViewBackgroundColor:)];
tapGesture.numberOfTapsRequired = 2;
tapGesture.numberOfTouchesRequired = 2;
[aView addGestureRecognizer:tapGesture];
[tapGesture release];
//长按手势
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(changeViewBackgroundColor:)];
longPress.minimumPressDuration = 2.0;
[aView addGestureRecognizer:longPress];
[longPress release];
//轻扫手势
UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(changeViewBackgroundColor:)];
[aView addGestureRecognizer:swipeGesture];
swipeGesture.direction = UISwipeGestureRecognizerDirectionDown;
[swipeGesture release];
//拖动手势
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panAction:)];
[aView addGestureRecognizer:panGesture];
[panGesture release];
//捏合手势
UIPinchGestureRecognizer *pinchGesture = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchAction:)];
[aView addGestureRecognizer:pinchGesture];
[pinchGesture release];
//旋转手势
UIRotationGestureRecognizer *rotationGesture = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotationAction:)];
[aView addGestureRecognizer:rotationGesture];
[rotationGesture release];
5.捏合,放大缩小 6.拖拽,移动位置 */
UIView *aView = [[UIView alloc] initWithFrame:CGRectMake(30, 30, 280, 280)];
aView.backgroundColor = [UIColor orangeColor];
[self.view addSubview:aView];
[aView release];
//轻拍手势
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(changeViewBackgroundColor:)];
tapGesture.numberOfTapsRequired = 2;
tapGesture.numberOfTouchesRequired = 2;
[aView addGestureRecognizer:tapGesture];
[tapGesture release];
//长按手势
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(changeViewBackgroundColor:)];
longPress.minimumPressDuration = 2.0;
[aView addGestureRecognizer:longPress];
[longPress release];
//轻扫手势
UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(changeViewBackgroundColor:)];
[aView addGestureRecognizer:swipeGesture];
swipeGesture.direction = UISwipeGestureRecognizerDirectionDown;
[swipeGesture release];
//拖动手势
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panAction:)];
[aView addGestureRecognizer:panGesture];
[panGesture release];
//捏合手势
UIPinchGestureRecognizer *pinchGesture = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchAction:)];
[aView addGestureRecognizer:pinchGesture];
[pinchGesture release];
//旋转手势
UIRotationGestureRecognizer *rotationGesture = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotationAction:)];
[aView addGestureRecognizer:rotationGesture];
[rotationGesture release];
0 0
- IOS中的六大手势
- ios六大手势的创建使用
- iOS中的手势
- IOS中的手势详解
- iOS中的七大手势
- iOS中的各种手势
- IOS 中的手势
- ios中的手势
- iOS中的手势详解
- ios中的6种手势
- ios开发中的手势添加
- iOS中的事件,手势识别
- iOS开发中的手势添加
- iOS开发中的手势总结
- iOS开发中的手势触发
- 关于iOS中的手势识别
- 总结iOS开发中的手势识别
- 谈谈iOS中的手势及触摸
- poj_1061
- Table Views(下)Grouped and Indexed Sections
- wps日期转换公式
- Android中的JSON详细总结
- hdu2006求奇数的乘积
- IOS中的六大手势
- 记录2
- 用block实现两个页面间的传值
- linux sed 用法
- 要WiFi还是要绿萝
- 关于redhat enterprise linux 6.4下oracle11g中文乱码问题总结
- StringBuffer类
- struct union
- eclipse高级技巧