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 enable "swipe to delete" until I set the scrollEnable property of the scrollView to NO , but it brings another problem : I can't swipe between the tableView and another view
Is there any ways other than setting the scrollEnable property to enable "swipe to delete" ?
If not , when should I set self.scrollEnable = NO, and when should I set self.scrollEnable = YES to have the "swipe to delete" and "swipe between views" both work fine ?
Thank you
I've successfully used
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
in a UIScrollView subclass containing the tableview to enable a UISwipeGestureRecognizer residing in the tableview to trigger instead of being swallowed by the "main" scrollview's gesture recognizers.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With