I have created a UITableView that can perform swipe-to-delete on its table cells in normal cases, but when I put the UITableView into a UIScrollView that can be horizontally scrollable, the outer scrollview will swallow the swipe event, thus the swipe-to-delete is not workable.
Asked
Active
Viewed 1,236 times
3 Answers
1
I'm sorry to tell you that you have to give up one for your function since the two functions rely on the same gesture.
If you want to keep the swipe-delete, set the outer scrollview.scrollEnabled = NO
. I think that would help.
If not, have a button to start the tableview edit mode. That will make you delete cell with the scrollview can be slided.

whoan
- 8,143
- 4
- 39
- 48

Henson Fang
- 1,177
- 7
- 30
1
I've finally found solution!
Subclass the outer UIScrollView, and override a method
-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
@interface AllowSwipeScrollView : UIScrollView
@end
@implementation AllowSwipeScrollView
-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{
BOOL inTableViewCell = .... // check the current touch is in table view cell
if (inTableViewCell) {
return NO;
}else{
return [super gestureRecognizerShouldBegin:gestureRecognizer];
}
}
@end
And make sure the UITableView instances are in AllowSwipeScrollView.

moligaloo
- 1,083
- 13
- 27
-
@Yoko if this method returns NO, the inner UITableView would receive swipe event automatically. – moligaloo Dec 24 '14 at 06:25
0
try This condition
if (ScrollView == self.tableView) return;
in scrollviewdidscroll method.

Rushi trivedi
- 737
- 1
- 15
- 37