Skip to content

如何解决 UIScrollView 和 UIPageViewController 全屏手势冲突? 附解决方案 #33

Description

@jocelen

问题描述

目前发现在不开启全屏手势情况下,系统的侧滑返回按钮还是会和UIScrollView冲突。
大佬之前提供的建议仅对开全全屏情况下才有用。而我期望是在不开启全屏配置情况下优先响应系统的侧滑返回。
所以,我这边对NXNavigationExtensionInternal.m源码修改,实现了预期
关闭:nx_enableFullScreenInteractivePopGesture, 任何界面都可以系统侧滑返回
开全: nx_enableFullScreenInteractivePopGesture,系统侧滑失效,UIScrollView需要设置优先级生效,其他view都可以全屏返回

Image
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer API_AVAILABLE(ios(7.0)) {
    
    //系统侧滑手势就返回YES,优先级最高
    BOOL isEdgePanGesture = [gestureRecognizer isKindOfClass:[UIScreenEdgePanGestureRecognizer class]];
    if (isEdgePanGesture)
    {
        return YES;
    }
    
    //全屏侧滑手势 属性开启情况下返回YES
    BOOL isFullScreenPan = [gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]];
    if (isFullScreenPan) {
        if (_navigationController.childViewControllers.lastObject.nx_enableFullScreenInteractivePopGesture)
        {
            return YES;
        }
    }
    
    return NO;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions