在UITableView单元格上处理Pan Gesture

时间:2017-11-21 07:20:52

标签: objective-c uitableview uipangesturerecognizer xcode9.1

我向UITableViewCell添加了MARKRangeSlider,它按预期工作。在拖动句柄时,表视图控制器也会弹出到前一个视图控制器。我怎么能避免或阻止弹出的动作?

我尝试通过添加委托来代码,但未能达到结果。

 - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
         // CGPoint velocity = [panGestureRecognizer  velocityInView:panGestureRecognizer.view];
         // return fabs(velocity.y) > fabs(velocity.x);
        CGPoint translation = [(UIPanGestureRecognizer *)gestureRecognizer translationInView:gestureRecognizer.view.superview];
        // if you want an NSString
        NSLog(@"gestureRecognizer-superview %@", NSStringFromClass([gestureRecognizer.view.superview class]) );
        return fabs(translation.x) > fabs(translation.y);
    }


- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
    if (otherGestureRecognizer == leftPanRecognizer) {
        return YES;
    }
    if (otherGestureRecognizer == rightPanRecognizer) {
        return YES;
    }
    return NO;
}

它的间歇性问题。请让我知道如何处理它?<​​/ p>

提前致谢

1 个答案:

答案 0 :(得分:0)

我找到了解决方案,

UITableViewControllerUIViewController UITableView interactivePopGestureRecognizer必须禁用 viewDidAppearinteractivePopGestureRecognizer相同< / strong>控制器开发人员必须在viewWillDisAppear启用 private void ConverCSVtoXlsx(ExcelPackage Package,string FileName) { var format = new ExcelTextFormat(); format.Delimiter = ','; Package.Workbook.Worksheets["Believer List"].Cells["A1"].LoadFromText(new FileInfo(Server.MapPath(@"~\BelieverUploadFiles\" + FileName)), format, OfficeOpenXml.Table.TableStyles.Medium27, true); Package.Save(); } 。希望它有所帮助。