Latest 1.2
Homepage https://github.com/yuzhidu/YUFullscreenGesture
License MIT
Platforms ios 7.0, requires ARC
Authors

全屏加返回手势
支持 iOS 7.0 以上系统

一、支持 cocoPods

pod 'YUFullscreenGesture'

二、方法

1.禁用 navigation controller 的 pop 手势

navigationController.yu_fullscreenPopGestureRecognizer.enabled = NO;

2.禁用 view controller 的 pop 手势

viewController.yu_interactivePopDisabled = YES;

3.隐藏导航条

可以不用 -setNavigationBarHidden:animated: 来隐藏导航条了,用以下方法代替:

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

4.带 scrollView 的页面

重写这个方法,当scrollView 的 x 偏移量不大于 0 时,手势生效。

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

三、例子

1.bar -> bar

snapshot

第一个例子中 Push a VC with bar
继承了框架就会拥有这项基本功能

2.bar -> without bar 和 without bar -> bar

snapshot

第二个例子,隐藏了导航条,依然可以完美使用

3.带 scrollWith

snapshot

scrollView 会响应手势,因此要重写

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer

在 scrollView 的 x 偏移量不大于零时,使用我们框架的 pop 手势

4.带 scrollView 和 tableView

snapshot

这种情况比较常见,但是跟例子3没有本质区别

Latest podspec

{
    "name": "YUFullscreenGesture",
    "version": "1.2",
    "summary": "An pop gesture.",
    "description": "YUFullscreenGesture is iPad and iPhone compatible. Supports landscape and portrait orientations and can be used inside UINavigationController.",
    "homepage": "https://github.com/yuzhidu/YUFullscreenGesture",
    "authors": {
        "u9a6cu88d5u535a": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "source": {
        "git": "https://github.com/yuzhidu/YUFullscreenGesture.git",
        "tag": "1.2"
    },
    "source_files": "YUFullscreenGesture/*.{h,m}"
}

Pin It on Pinterest

Share This