Git Product home page Git Product logo

fullscreenpopgesture's Introduction

FullscreenPopGesture

iOS 全屏返回手势。使用黑魔法,在UINavigationController的分类或者UIViewController控制是否启用手势。轮子的创造大部分借鉴sunnyxx的FDFullscreenPopGesture

使用方法

  • 导入头文件FullscreenPopGesture.h

  • 全局手势开关

self.navigationController.popGestureRecognizer.enabled = YES;//默认开启
  • 控制器属性开关
self.interactivePopDisabled = NO;//当前控制器是否开启手势,默认NO
self.prefersNavigationBarHidden = NO;//导航条是否隐藏,默认NO

手势冲突

当控制器的view包含UIScrollView,全局手势会与UIScrollView默认的手势冲突。解决思路:判断全局手势,并且滑动到最左侧,则启用多重手机,否则不启用多重手势。

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    
    if (self.contentOffset.x <= 0) {
        if ([otherGestureRecognizer.delegate isKindOfClass:NSClassFromString(@"UINavigationController")]) {
            return YES;
        }
    }
    return NO;
}

截图

snapshot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.