关于手势 — 手势添加tag值
2016-03-21 16:31
281 查看
当我们定义了多个手势得时候,就需要对收拾做一些区分,当然不区分,每个手势定义一个方法名也是可以的,就是麻烦,所以···
通常我们是给控件加tag值来区分的,当然,手势没有自带的tag属性,但是手势所属的view具有tag属性,
手势方法中实现如下
- (void)buttonJump:(UITapGestureRecognizer *)tapGesture{
通常我们是给控件加tag值来区分的,当然,手势没有自带的tag属性,但是手势所属的view具有tag属性,
UITapGestureRecognizer *tapGeture1 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(buttonJump:)]; tapGeture1.delegate = self; [_bView1 addGestureRecognizer:tapGeture1]; UIView *tapView1 = [tapGeture1 view]; tapView1.tag = 151; UITapGestureRecognizer *tapGeture3 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(buttonJump:)]; tapGeture3.delegate = self; [_bView3 addGestureRecognizer:tapGeture3]; UIView *tapView3 = [tapGeture3 view]; tapView3.tag = 153;
手势方法中实现如下
- (void)buttonJump:(UITapGestureRecognizer *)tapGesture{
UITapGestureRecognizer *singleTap = (UITapGestureRecognizer *)tapGesture; NSInteger index = singleTap.view.tag; switch (index) { case 151:{ ActivitySignUpViewController *actSignUpVC = [[ActivitySignUpViewController alloc]initWithNibName:@"ActivitySignUpViewController" bundle:[NSBundle mainBundle]]; [self.navigationController pushViewController:actSignUpVC animated:YES]; break; } default: break; } }
相关文章推荐
- Swift中实现点击、双击、捏、旋转、拖动、划动、长按手势的类和方法介绍
- 基于Android中手势交互的实现方法
- Android程序开发之给背景图加上移动的手势
- 实例详解用户输入 i. 检测常用手势
- Android应用开发中触摸屏手势识别的实现方法解析
- Android实现手势控制ImageView图片大小
- IOS手势操作(拖动、捏合、旋转、点按、长按、轻扫、自定义)
- iOS开发中的几个手势操作实例分享
- HTML5单页面手势滑屏切换原理
- iOS 使用手势UIGestureRecognizer对图像进行缩放、移动、旋转等操作
- iOS- UIImageView/手势识别
- 基于一次手势训练的kinect 3D 动态手势识别(提纲)
- UIGestureRecognizer
- UI初级连载十一-------触摸与手势
- 安卓,让edittext随手指移动而改变位置
- android中的手势探测
- iOS Gesture 手势
- Android手势识别
- 手势识别模块+Python给PC增加点快捷键
- 手势 gesture