Coder Social home page Coder Social logo

gavinbin / fdfullscreenpopgesture Goto Github PK

View Code? Open in Web Editor NEW

This project forked from forkingdog/fdfullscreenpopgesture

0.0 2.0 0.0 1.08 MB

A UINavigationController's category to enable fullscreen pop gesture with iOS7+ system style.

License: MIT License

Ruby 11.67% Objective-C 88.33%

fdfullscreenpopgesture's Introduction

FDFullscreenPopGesture

An UINavigationController's category to enable fullscreen pop gesture in an iOS7+ system style with AOP.

Overview

snapshot

这个扩展来自 @J_雨 同学的这个很天才的思路,他的文章地址:http://www.jianshu.com/p/d39f7d22db6c

Usage

AOP, just add 2 files and no need for any setups, all navigation controllers will be able to use fullscreen pop gesture automatically.

To disable this pop gesture of a navigation controller:

navigationController.fd_fullscreenPopGestureRecognizer.enabled = NO;

To disable this pop gesture of a view controller:

viewController.fd_interactivePopDisabled = YES;

Require at least iOS 7.0.

View Controller Based Navigation Bar Appearance

It handles navigation bar transition properly when using fullscreen gesture to push or pop a view controller:

  • with bar -> without bar
  • without bar -> with bar
  • without bar -> without bar

snapshot with bar states

This opmiziation is enabled by default, from now on you don't need to call UINavigationController's -setNavigationBarHidden:animated: method, instead, use view controller's specific API to hide its bar:

- (void)viewDidLoad {
    [super viewDidLoad];
    self.fd_prefersNavigationBarHidden = NO;
}

And this property is NO by default.

View Controller With ScrollView

If you want to use fullscreen pop gesture in ViewController with scrollView or subclass of scrollView , you should customize the scrollView or subclass of scrollView and overload the gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: method . like this:

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

Installation

Use CocoaPods

pod 'FDFullscreenPopGesture', '1.1'

Release Notes

1.1 - View controller based navigation bar appearance and transition.
1.0 - Fullscreen pop gesture.

License

MIT

fdfullscreenpopgesture's People

Contributors

sunnyxx avatar afantree avatar philcn avatar readmecritic avatar leichunfeng avatar

Watchers

James Cloos avatar zhang avatar

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.