Skip to content

Latest commit

 

History

History
51 lines (39 loc) · 1.72 KB

全屏手势处理.md

File metadata and controls

51 lines (39 loc) · 1.72 KB

全屏手势处理

这里主要针对FDFullscreenPopGesture示例处理,其他同类手势即可按照此方法处理。 详情请参考OC版本示例demo类FullScreenGestureViewController

准备

JXPagerView处理

  • 实现相关代理方法
- (Class)scrollViewClassInlistContainerViewInPagerView:(JXPagerView *)pagerView {
    return [FullScreenGestureScrollView class];
}
  • 然后在FullScreenGestureScrollView自定义类里面实现手势代理方法 参考的是FDFullscreenPopGesture的官方文档View Controller With ScrollView
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    if (collectionView.contentOffset.x <= 0) {
        if ([otherGestureRecognizer.delegate isKindOfClass:NSClassFromString(@"_FDFullscreenPopGestureRecognizerDelegate")]) {
            return YES;
        }
    }
    return NO;
}

JXCategoryCollectionView处理

  • 遵从JXCategoryCollectionViewGestureDelegate协议
self.categoryView.collectionView.gestureDelegate = self
  • 实现相关代理方法
- (BOOL)categoryCollectionView:(JXCategoryCollectionView *)collectionView gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    if (collectionView.contentOffset.x <= 0) {
        if ([otherGestureRecognizer.delegate isKindOfClass:NSClassFromString(@"_FDFullscreenPopGestureRecognizerDelegate")]) {
            return YES;
        }
    }
    return NO;
}