UIScrollView滑动与轻扫手势冲突
来源:互联网 发布:linux 命令源码 编辑:程序博客网 时间:2024/04/29 20:34
遵循UIGestureRecognizerDelegate协议
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(sWidth * (_imagesArr.count - 1), 1, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)]; UISwipeGestureRecognizer *swip = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(enterApp:)]; [view addGestureRecognizer:swip]; view.userInteractionEnabled = YES; _scrollView.userInteractionEnabled = YES; view.backgroundColor = [UIColor clearColor];// [btn addTarget:self action:@selector(enterApp:) forControlEvents:UIControlEventTouchUpInside]; swip.direction = UISwipeGestureRecognizerDirectionLeft; swip.delegate = self;// swip.direction = UISwipeGestureRecognizerDirectionUp; [_scrollView addSubview:view];
添加手势的代理方法
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{ // 首先判断otherGestureRecognizer是不是系统pop手势 if ([otherGestureRecognizer.view isKindOfClass:NSClassFromString(@"UILayoutContainerView")]) { // 再判断系统手势的state是began还是fail,同时判断scrollView的位置是不是正好在最左边 if (otherGestureRecognizer.state == UIGestureRecognizerStateBegan && _scrollView.contentOffset.x == sWidth*3) { return NO; } } return YES;}
阅读全文
0 0
- UIScrollView滑动与轻扫手势冲突
- 轻扫手势
- 轻扫手势
- ios 轻扫手势
- iOS UIScrollView左右滑动手势与返回手势冲突的解决办法
- 轻扫(swipe)手势
- IOS学习 触摸和手势 手势识别器:单击、双击、轻扫、滑动、长按、旋转
- 轻扫手势/平移、长按手势
- 解决UIScrollView和滑动返回手势的冲突
- iOS UIGestureRecognizer(手势、单击、拖拽 、拖拽、旋转、轻扫 、长按、边缘滑动,功能介绍)~demo
- 侧滑手势与UIScrollView滚动手势冲突解决
- iOS轻扫手势(Swipe)
- iOS七大手势之(平移、捏合、轻扫、屏幕边缘轻扫)手势识别器方法
- iOS七大手势之(平移、捏合、轻扫、屏幕边缘轻扫)手势识别器方法
- UIScrollView的上下滑动和自己添加的滑动手势冲突
- UIPanGestures手势与UITableviewCell上滑动删除手势冲突
- UIScrollView滑动与UITableView左滑删除冲突问题解决方案
- UIGestureRecognizerDelegate两三事 & UIScrollView滑动 子View上UIPanGestureRecognizer手势冲突
- selenium自动化登陆163邮箱(17.07.04更)
- 区间覆盖问题
- C语言实现扫雷
- 高端很高端 异常高端
- 视图、序列、索引 、约束
- UIScrollView滑动与轻扫手势冲突
- 11、伪类选择器
- 每天一个linux命令(35):ln 命令
- c++之回调实现方式
- (12)数组定义以及引用类型堆内存分配、数组名赋值问题
- MySQL中索引的基础知识
- android/IOS NTP 获取在线的GMT 网络时间
- 关于模糊控制算法
- shell开发错误记录