swipe to delete in a UITableView which is embeded in a UIScrollView

后端 未结 5 1553
猫巷女王i
猫巷女王i 2020-12-17 04:04

I\'ve encountered a problem the same as UIScrollview enable delete row by swipe
It is a tableView and another view work as subViews of a scrollView , and I can\'t enab

5条回答
  •  渐次进展
    2020-12-17 04:51

    You need to use custom subclass of UIScrollView. It should works with table views in horizontal scroll views:

    @interface MyCoolScrollView : UIScrollView
    
    @end
    
    @implementation MyCoolScrollView
    
    // Allows inner UITableView swipe-to-delete gesture
    - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRequireFailureOfGestureRecognizer:(nonnull UIGestureRecognizer *)otherGestureRecognizer
    {
        return [otherGestureRecognizer.view.superview isKindOfClass:[UITableView class]];
    }
    
    @end
    

提交回复
热议问题