Reaper Reaper - 11 months ago 103
Objective-C Question

UITableView Swipe to delete not working properly on iOS8

I have a view controller, having a uitableview inside a uiview. The delegate and datasource embeded properly and everything is working fine.

I am using commitEditingStyle and canEditRowAtIndexPathMethods delegate methods for swipe to delete functionality.

The usage of methods are as follows.

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

if (editingStyle == UITableViewCellEditingStyleDelete) {

NSDictionary *dataElement = [cartArray objectAtIndex:indexPath.row];

NSString *productId = [dataElement objectForKey:@"id"];
NSString *productSizeId = [dataElement objectForKey:@"beden_id"];

[self deleteTableRowWithId:productId sizeId:productSizeId];


- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{
return YES;

The swipe gesture and delegate methods are working very fine without any problem on iOS7 tested both on emulator and device, however on iOS8 the swipe gesture doesn't work properly.

I tested this on iOS8 using iPhone 6 and to activate swipe I need to swipe like 20 times or more and from the edge table cell, sometimes cant even manage to get the swipe delete button at all.

I checked and tried most of the solutions on stack-overflow. Any help or suggestion will be deeply appreciated.

Hierarchy in the storyboard is like in the picture below.

Storyboard Table Cell

Answer Source

Same issue, swipes would only work about 20% of the time on both simulator and device. In my case it was caused by ECSlidingViewController (a popular sliding menu implementation), which sets up a horizontal pan gesture to open the menu. This gesture needs to be disabled in the viewDidAppear: of the controller where you want swipe-to-delete to work properly:

#import "ECSlidingViewController.h"

- (void)viewDidAppear:(BOOL)animated {
     [super viewDidAppear:animated];

     // Disable sliding menu pan gesture so it doesn't conflict with table view swipe-to-delete
     self.slidingViewController.panGesture.enabled = NO;

Make sure to re-enable the pan gesture if you want other controllers to be able to use it:

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];

    // Re-enable sliding menu pan gesture so other controllers can use it
    self.slidingViewController.panGesture.enabled = YES;

See this pull request for more info on the issue:

Long story short, whether you're using ECSlidingViewController or not, make sure there are no other pan gestures set up that collide with the swipe-to-delete pan gesture.