Get Swipe to Delete on UITableView to Work With UIPanGestureRecognizer
I have a UIPanGuestureRecognizer added to the entire view using this code:
UIPanGestureRecognizer *pgr = [[UIPanGestureRecognizer alloc]
initWithTarget:self action:@selector(panAction:)];
[[self view] addGestureRecognizer:pgr];
Within the main view I have a UITableView which has this code to enable
the swipe to delete feature:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView
editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"RUNNING2");
return UITableViewCellEditingStyleDelete;
}
- (BOOL)tableView:(UITableView *)tableView
canEditRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row >= _firstEditableCell && _firstEditableCell != -1)
NSLog(@"RUNNING1");
return YES;
else
return NO;
}
Only RUNNING1 is printed to the log. I believe the reason for this is the
UIPanGestureRecognizer, but I am not sure. If this is correct how should I
go about fixing this. If this is not correct please provide the cause and
fix. Thanks.
No comments:
Post a Comment