关闭

iOS全屏滑动返回

标签: ios
56人阅读 评论(0) 收藏 举报
分类:

#import “GLNavigationController.h”
@interface GLNavigationController ()
@end
@implementation GLNavigationController
- (void)viewDidLoad {
[super viewDidLoad];
id target = self.interactivePopGestureRecognizer.delegate;
SEL handler = NSSelectorFromString(@”handleNavigationTransition:”);
// 获取添加系统边缘触发手势的View
UIView *targetView = self.interactivePopGestureRecognizer.view;
// 创建pan手势 作用范围是全屏
UIPanGestureRecognizer * fullScreenGes = [[UIPanGestureRecognizer alloc]initWithTarget:target action:handler];
fullScreenGes.delegate = self;
[targetView addGestureRecognizer:fullScreenGes];
// 关闭边缘触发手势 防止和原有边缘手势冲突
[self.interactivePopGestureRecognizer setEnabled:NO];
}

// 防止导航控制器只有一个rootViewcontroller时触发手势
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
return self.childViewControllers.count == 1 ? NO : YES;
}
@end

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:3551次
    • 积分:169
    • 等级:
    • 排名:千里之外
    • 原创:13篇
    • 转载:1篇
    • 译文:0篇
    • 评论:1条
    文章分类
    最新评论