美文网首页
iOS禁用系统侧滑返回手势

iOS禁用系统侧滑返回手势

作者: Super宗Sir | 来源:发表于2019-03-26 23:41 被阅读0次

-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
if([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
}

  • (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
    self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    }
    }

不管用画的用这个
id traget = self.navigationController.interactivePopGestureRecognizer.delegate;
UIPanGestureRecognizer * pan = [[UIPanGestureRecognizer alloc]initWithTarget:traget action:nil];
[self.view addGestureRecognizer:pan];

相关文章

网友评论

      本文标题:iOS禁用系统侧滑返回手势

      本文链接:https://www.haomeiwen.com/subject/rkgovqtx.html