forkingdog /FDFullscreenPopGesture
A UINavigationController's category to enable fullscreen pop gesture with iOS7+ system style.
★ 5,869⑂ 1,139👁 144⑃ 38● 177▤ 0
More from this author
+0
Daily
5,869
stars
1,139
forks
144
watchers
38
prs
177
issues
0
releases
README
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:
objc
navigationController.fd_fullscreenPopGestureRecognizer.enabled = NO;
To disable this pop gesture of a view controller:
objc
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:
objc
- (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:
objc
- (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
ruby
pod 'FDFullscreenPopGesture', '1.1'
Release Notes
1.1 - View controller based navigation bar appearance and transition.
1.0 - Fullscreen pop gesture.
License
MITTop issues
#97ios 9.3下,导航栏错乱17 comments · 2016-08-26#42从带有导航栏push到第一级无导航栏VC,再push到第二级无导航栏VC,在第二级VC侧滑返回时取消,这时候侧滑到第一个VC的时候,导航栏出问题了!!!14 comments · 2015-11-16#76导航栏显示问题,A无导航栏,B无导航栏,C有导航栏,D有导航栏,A->B->C->D,在B的时候右滑,松开,13 comments · 2016-04-15#12presentViewController MFMessageComposeViewController后取消按钮不见了11 comments · 2015-06-15#177全屏手势禁用问题9 comments · 2018-03-30#163第一个viewController隐藏导航栏时滑动返回存在问题8 comments · 2017-11-29#23pods 中的1.1版本没有`fd_interactivePopMaxAllowedInitialDistanceToLeftEdge`这个接口,望更新。7 comments · 2015-07-14#84如果不想全屏划动,想保留系统的边缘右划怎么办?6 comments · 2016-06-16