美文网首页
iOS tableview左滑删除不灵敏

iOS tableview左滑删除不灵敏

作者: 豪冷 | 来源:发表于2019-07-29 10:20 被阅读0次

事件:左滑删除事件,成了概率事件。

猜想:自定义的BaseViewController或者BaseNavigationController中的处理影响了左滑事件。

证实:确实如此!把下面那段代码注释后,滑动又6起来了~

code:

#if 0
    // 获取系统自带滑动手势的target对象
    id target = self.interactivePopGestureRecognizer.delegate;
    
    SEL handleTransition = NSSelectorFromString(@"handleNavigationTransition:");
    // 创建全屏滑动手势,调用系统自带滑动手势的target的action方法
    UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:target action:handleTransition];
    // 设置手势代理,拦截手势触发
    pan.delegate = self;
    // 给导航控制器的view添加全屏滑动手势
    [self.view addGestureRecognizer:pan];
    // 禁止使用系统自带的滑动手势
    self.interactivePopGestureRecognizer.enabled = NO;
#endif

相关文章

网友评论

      本文标题:iOS tableview左滑删除不灵敏

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