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

Overview

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

Comments
  • 连着Push两个NavigationBarHidden的ViewController之后出现BUG

    连着Push两个NavigationBarHidden的ViewController之后出现BUG

    1、push一个ViewController,hideNavigationBar 2、push一个ViewController,hideNavigationBar 3、右滑触发返回手势,不要完全返回,左滑取消返回手势 4、正常滑动返回两个ViewController 5、任意Push一个ViewController,发现NavigationBarItem为viewControllers[0]的NavigationBarItem

    另外,早上无意发现另一种方法。。。 NavigationController中直接使用 object_setClass(self.interactivePopGestureRecognizer, [UIPanGestureRecognizer class]); 即可

    BUG如下图所示。。当然这个直接使用系统的也会有问题

    navigationbug_2

    opened by lovesunstar 7
  • 9.0之后出现的bug

    9.0之后出现的bug

    手机系统是8.4 使用了FDFullscreenPopGesture 然后从A push到B 使用手势滑动返回,出现了崩溃的BUG 提示 跟

    @property(nonatomic, copy) NSArray<NSNumber *> *allowedTouchTypes NS_AVAILABLE_IOS(9_0); // Array of UITouchTypes as NSNumbers. @property(nonatomic, copy) NSArray<NSNumber *> *allowedPressTypes NS_AVAILABLE_IOS(9_0); // Array of UIPressTypes as NSNumbers.

    这个两个属性有关

    opened by HatsuneMikuV 6
  • 当项目中用了KINWebBrowserViewController这个第三方后

    当项目中用了KINWebBrowserViewController这个第三方后

    如果控制器A,隐藏导航条,设置了 self.fd_prefersNavigationBarHidden = YES; push到控制器B,B中有KINWebBrowserViewController ,此时如果用手往右侧滑动B一丢丢,快速的松手,此时的导航条会在 隐藏/显示 间不断的切换。

    KINWebBrowserViewController 中部分代码如下: `

    • (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated];

      [self.navigationController setNavigationBarHidden:NO animated:YES]; [self.navigationController setToolbarHidden:YES animated:YES];

      [self.navigationController.navigationBar addSubview:self.progressView];

      [self updateToolbarState]; }

    • (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated];

      [self.navigationController setNavigationBarHidden:self.previousNavigationControllerNavigationBarHidden animated:animated];

      [self.navigationController setToolbarHidden:self.previousNavigationControllerToolbarHidden animated:animated];

      [self.uiWebView setDelegate:nil]; [self.progressView removeFromSuperview]; } `

    作者有时间可以看下~

    opened by yanglezyq 5
  • 我发现有一个简单的办法

    我发现有一个简单的办法

    可以直接kvc,实测过完全没问题,楼主以为UIScreenEdgePanGestureRecognizer这里面只有一个属性不能更改,其实里面有私有属性,用kvc就可以了,很方便哦。 [self.interactivePopGestureRecognizer setValue:@([UIScreen mainScreen].bounds.size.width) forKeyPath:@"_recognizer._settings._edgeSettings._edgeRegionSize"];

    opened by wu736139669 5
  • 今天 APP 被拒了,说使用了私有 API : PrivateFrameworks/ChatKit.framework

    今天 APP 被拒了,说使用了私有 API : PrivateFrameworks/ChatKit.framework

    ChatKit.framework里的头文件基本上都是CK开头的,我就使用命令行搜整个项目文件发现 FDFullscreenPopGesture使用了if ([viewController isKindOfClass:NSClassFromString(@"CKSMSComposeController")])难道是因为这个判断的原因导致被拒的?

    opened by LisonFan 4
  • 能不能不碰私有API?

    能不能不碰私有API?

    代码挺好,但是利用了私有API有点虚,万一审核人员较真就悲剧了,而且感觉就是个定时炸弹。技术上来说,有没可能绕开?

    // 1. 私有变量标志transition动画是否正在进行 [self.navigationController valueForKey:@"_isTransitioning"]; // 2. 一个内部的selector NSSelectorFromString(@"handleNavigationTransition:");

    顺道问下,为啥需要者两个私有的API?

    opened by liuxuan30 4
  • 求解惑

    求解惑

    大神, 我有两点疑惑.如下:

    1. load方法中替换pushViewController:animated:时, 在此处为什么需要调用class_replaceMethod...

    2. 如果class_replaceMethod执行了, 而fd_pushViewController:animated:方法中会调用自己, 岂不是造成无限循环啦?

    opened by changsanjiang 3
  • 我擦swizzle

    我擦swizzle

    这是个好东西,好多轮子也都喜欢用,也确实能起到意想不到的效果。。。但是第三方库多了,这个东西就会很恶心,会有很对你意想不到的问题。。。。

    个人觉得,整个项目有一个就够了,自己管理,不容出问题。可以让用户在你指定的地方主动调用你的方法。

    FDFullscreenPopGesture 的uiviewcontroller的load导致我们一些navigationController显示混乱。我只好把load都干掉,全部统一管理,这样一来,我就不能用pod了,真可惜。。。

    opened by duanhjlt 3
  • 1.1返回时隐藏NavigationBar失效

    1.1返回时隐藏NavigationBar失效

    • (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated];

      // Do any additional setup after loading the view. [[self navigationController] setNavigationBarHidden:YES animated:YES]; //并没有卵用了 }

    1.0测试了下没有问题。

    opened by ycge234 3
  •   iOS 14设置 self.fd_prefersNavigationBarHidden = YES; 导航栏间出现动画突兀的问题

    iOS 14设置 self.fd_prefersNavigationBarHidden = YES; 导航栏间出现动画突兀的问题

    iOS 14设置 self.fd_prefersNavigationBarHidden = YES; 导航栏间出现动画突兀的问题 描述: 在iOS 14 A页面导航栏隐藏,B页面导航栏不隐藏,A设置self.fd_prefersNavigationBarHidden = YES; 在A->B 或者B->A 页面跳转的过程中,出现导航过渡动画的突兀,跳转页面在导航位置的颜色会一直显示一部分,直至另一个页面加载完全才消失;

    opened by LINDreaming 2
  • UIBarButtonItem会消失。 导航栏设置leftBarButtonItems 如果其中包含了UIBarButtonSystemItemFixedSpace类型

    UIBarButtonItem会消失。 导航栏设置leftBarButtonItems 如果其中包含了UIBarButtonSystemItemFixedSpace类型

    系统是ios11.1.2

    就会出现拖动后送开(稍微拖动一下,不会触发返回的那种),多试几次就会出现,并不是每次都有,然后导航栏的leftBarButtonItems就不显示了

    1

    2

    图1和图2注意看左边的结构,图2就是拖动一下然后松开,“cs”按钮就不见了 但是看到内存中是有的,但是ownerview变为了nil

    opened by 964562398 2
  • 在swift中使用 fd_prefersNavigationBarHidden 和 fd_interactivePopDisabled

    在swift中使用 fd_prefersNavigationBarHidden 和 fd_interactivePopDisabled

    在swift中使用 fd_prefersNavigationBarHidden 和 fd_interactivePopDisabled 中报错

    [ForexSwift.WebViewController setFd_prefersNavigationBarHidden:]: unrecognized selector sent to instance 0x7fcb2702fcb0

    在报错之前打断点 再过掉就可以,不知道什么原因

    opened by LittleXu 0
  • fd_prefersNavigationBarHidden BUG

    fd_prefersNavigationBarHidden BUG

    fd_prefersNavigationBarHidden defaults to NO, which leads to a bug when the two interfaces that need to be YES slide back to the animation. The navigation bar is displayed. When a hidden navigation bar interface jumps to the next interface, the navigation bar should theoretically be hidden Actually shows up

    opened by 623034345 0
Owner
Staying like a fool, forking like a dog.
null
Drag gesture modifier to easily apply to any view.

SwiftUIDragModifier A description of this package. This is my first SwiftUI Package. It provides a quick way to make any SwiftUI View draggable. After

Alphonso Sensley II 0 Nov 5, 2021
Peek and Pop with backwards-compatibility

PeekPop Peek and Pop is a great new iOS feature introduced with iPhone 6S and 6S+ that allows you to easily preview content using 3D touch. Sadly, alm

Roy Marmelstein 2k Dec 8, 2022
Media view which subclasses UIImageView, and can display & load images, videos, GIFs, and audio and from the web, and has functionality to minimize from fullscreen, as well as show GIF previews for videos.

I've built out the Swift version of this library! Screenshots Description ABMediaView can display images, videos, as well as now GIFs and Audio! It su

Andrew Boryk 80 Dec 20, 2022
iOS7 style drop in replacement for UISwitch

SevenSwitch iOS7 style drop in replacement for UISwitch Usage Cocoapods pod 'SevenSwitch', '~> 2.1' Swift support was added in version 2.0. If your p

Ben Vogelzang 779 Sep 5, 2022
ElongationPreview is an elegant UI push-pop style view controller

ElongationPreview is an elegant UI push-pop style view controller

Ramotion 886 Dec 19, 2022
:hatching_chick: Lightweight Swift loading activity for iOS7+

EZLoadingActivity Lightweight Swift loading activity for iOS7+. Really simple to use, just add the class and write 1 line of code. Easy to use: EZLoad

Goktug Yilmaz 611 Dec 22, 2022
Syntactic sugar in Swift for asynchronous dispatches in Grand Central Dispatch (iOS7+ and OS X 10.9+ compatible)

Async.legacy Syntactic sugar in Swift for asynchronous dispatches in Grand Central Dispatch (GCD) Async rewritten for iOS7 and OS X 10.9 Compatibility

Joseph Lord 31 Jul 1, 2019
Lightweight Swift loading activity for iOS7+

EZLoadingActivity Lightweight Swift loading activity for iOS7+. Really simple to use, just add the class and write 1 line of code. Easy to use: EZLoad

Goktug Yilmaz 611 Dec 22, 2022
Enable autocomplete use resources in swift project.

ResourceKit Enable autocomplete use resources in swift project. まだハードコードで消耗してるの? ResourceKitで安全コーディング! How does ResourceKit work? ResouceKit makes you

bannzai 90 Nov 25, 2022
Proxitee iOS SDK to enable iOS apps to use the Proxitee platform with iBeacon and GeoFencing

Proxitee iOS SDK Introduction The Proxitee iOS SDK allows you to enable your iOS devices to use the Proxitee platform with iBeacons and GeoFences, for

Proxitee 16 Jun 4, 2022
Tourist App enable users to search about touristic places in saudi arabia

TouristApp Project Name: Tourist Project Description : Tourist it's App enable users to search about touristic places in saudi arabia . Features List:

tasneemJafsher 0 Jan 6, 2022
DGPreview - Make UIKit project enable preview feature of SwiftUI

DGPreview Make UIKit project enable preview feature of SwiftUI Requirements iOS

donggyu 5 Feb 14, 2022
Keep track of accessibility settings, leverage high contrast colors, and use scalable fonts to enable users with disabilities to use your app.

Accessibility for iOS, macOS, tvOS, and watchOS ?? What's new in Capable 2.0 ?? Here are the most important changes: ?? New framework architecture and

Christoph Wendt 230 Jan 4, 2023
UIWindow subclass to enable behavior like adaptive round-corners & detecting when Control Center is opened.

UIWindow subclass to enable behavior like adaptive round-corners & detecting when Control Center is opened.

Aaron Abentheuer 481 Jul 28, 2022
A package that allows you to easily enable the Xcode canvas to a UIKit view.

UIViewCanvas This package allows you to enable a SwiftUI Xcode canva to a UIView or a entire ViewController. Why? Run emulator everytime you need to t

Wender 14 Jun 9, 2022
A Simple iOS QR code scanner that allows users to enable their camera and local Photo Library accesses to scan the contents of the input QR codes.

iOS QR Code Scanner A Simple iOS QR code scanner using Swift UI. Jump to: ContentView.swift screenshot 1.1.5 NOTE: be aware of the new horizontal line

Krystal Zhang 0 Jan 1, 2023
Server Driven UI can enable faster iterations and allowing apps to instantly update on multiple platforms.

Pets App Server Driven UI can enable faster iterations and allowing apps to instantly update on multiple platforms Steps to run Pets-Web: Download or

Metin Atalay 0 Jun 11, 2022
Enable WebSocket in OPC DA/AE Server with JSON return, first time ever

WebSocket4OPC Enable WebSocket in OPC DA/AE Server with JSON return, first time ever DCOM was developed more than 2 decades ago, wich was the pillar o

null 13 Dec 14, 2022
Asynchronous image downloader with cache support as a UIImageView category

This library provides an async image downloader with cache support. For convenience, we added categories for UI elements like UIImageView, UIButton, M

null 24.4k Jan 5, 2023
A "time ago", "time since", "relative date", or "fuzzy date" category for NSDate and iOS, Objective-C, Cocoa Touch, iPhone, iPad

Migration 2014.04.12 NSDate+TimeAgo has merged with DateTools. DateTools is the parent project and Matthew York is the project head. This project is n

Kevin Lawler 1.8k Dec 2, 2022