1

I am using XLPagerTabStrip to swipe between pages. One of those pages has a tableview. I am trying to implement swipe to delete on this tableview, but the DELET button only shows from time to time when swiping.

This is the code I have:

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {

  if (editingStyle == UITableViewCellEditingStyleDelete) {

    if ([storiesArray count] >= 1) {
        // code to delete row
    }
  }
}



- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
   NSLog(@"I am allowing a swipe");
   // Return YES if you want the specified item to be editable.
   return YES;
}

I can see the NSLog I am allowing to swipe so I know the swipe has been detected, but I can only see the DELETE button occasionally. I can't find the reason why it does not show the delete button. I have searched every post on this, and have asked xmartlabs if implementing their code would affect swipe to delete, but it doesn't make sense that it does work occasionally.

Would anyone have any idea what else I can do to understand why the delete button doesn't show ALWAYS?

Thanks.

PiyushRathi
  • 956
  • 7
  • 21
user3079872
  • 191
  • 1
  • 5
  • 15

1 Answers1

0

You can disable scrolling on XLPagerTabStrip's containerView, so the scrolls will be handled by inner views.

There is also a similar question with an answer.

Community
  • 1
  • 1
Ali Momen Sani
  • 840
  • 2
  • 11
  • 26
  • thank you. I had seen that question but I don't want to disable scrolling on XLPagerTanStrip... I want to still be able to scroll between pages. Is that possible? – user3079872 Dec 19 '16 at 14:28
  • @user3079872 Swiping on a `tableview` will always trigger a delete action, how are you going to differentiate those? – Ali Momen Sani Dec 21 '16 at 10:10
  • I am not differentiating them, I think that might be the problem ... How would I go about differentiating them? Thanks – user3079872 Dec 23 '16 at 12:11
  • @user3079872 It seems to be impossible. Every swipe on a `uitableview` is on a row, and you need to trigger delete action, so where should you swipe to mean "I want to go to the other tab"? – Ali Momen Sani Dec 23 '16 at 20:57
  • @AliMomenSaniI am also facing the same issue with XLPagerTabStrip, is there any way to add Swipe to delete feature? – user2786 Apr 15 '19 at 10:24