iOS手势冲突(JXCategoryView滚动手势与侧滑、UITableView又划删除)
来源:     阅读:2018
织梦模板店
发布于 2021-03-20 18:34
查看主页
iOS手势冲突(JXCategoryView滚动手势与侧滑、UITableView又划删除)

处理后的效果图 (待定上传)

JXCategoryListContainerViewDelegate 提供了一个可选的协议方法:

@optional/** 返回自己设置UIScrollView或者UICollectionView的Class 某些特殊情况需要自己解决UIScrollView内部逻辑。比方项目用了FDFullscreenPopGesture,需要解决手势相关代理商。 @param listContainerView JXCategoryListContainerView @return 自己设置UIScrollView实例 */- (Class)scrollViewClassInlistContainerView:(JXCategoryListContainerView *)listContainerView;

看到这个我就知道怎样弄了,咱们可以自己设置一个自己设置UIScrollView或者UICollectionView 在里面实现手势的控制,我这里初始化[[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self]因而需要自己设置一个UIScorllView来控制手势,让它兼容多种手势共存
1.ServiceScrollView.h

@interface ServiceScrollView : UIScrollView<UIGestureRecognizerDelegate>@end

2.ServiceScrollView.m

@implementation ServiceScrollView/** 重载UIScrollView手势 能否支持多手势触发,1.返回YES,则可以多个手势一起触发方法;2.返回NO则为互斥 // called when the recognition of one of gestureRecognizer or otherGestureRecognizer would be blocked by the other // return YES to allow both to recognize simultaneously. the default implementation returns NO (by default no two gestures can be recognized simultaneously) // // note: returning YES is guaranteed to allow simultaneous recognition. returning NO is not guaranteed to prevent simultaneous recognition, as the other gesture's delegate may return YES */- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {    if (gestureRecognizer.state != UIGestureRecognizerStatePossible) {        return YES;    } else {        return NO;    }}
  1. 在使用JXCategoryView的控制器中实现JXCategoryListContainerViewDelegate
- (Class)scrollViewClassInlistContainerView:(JXCategoryListContainerView *)listContainerView{    return [ServiceScrollView class];}
免责声明:本文为用户发表,不代表网站立场,仅供参考,不构成引导等用途。 系统环境 windows
相关推荐
首页
搜索
订单
购物车
我的