iOS Undo the deleted cells in my tableview : <p>In my project i just want to hide the cells when swipe happend. if i hide the cell from tableview undo button will generate top of my navigation bar. Click on undo button the hidden cells should reappear.</p>

<p>Here is my code..</p>

<pre><code>-(NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {


    Download *download = [self.downloadManager.downloads objectAtIndex:indexPath.row];

    // Get path to documents directory
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

    NSString *documentsPath = [paths objectAtIndex:0];

    // Get zip file from path..

    NSString *fileInDocumentsPath = [documentsPath stringByAppendingPathComponent:download.name];

    NSLog(@"Looking for zip file %@", fileInDocumentsPath);

    if ([[NSFileManager defaultManager] fileExistsAtPath:fileInDocumentsPath])
    {
        UITableViewRowAction *HideAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Hide" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
            //insert your editAction here

            [self.downloadManager.downloads removeObjectAtIndex:indexPath.row];

            [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];

            [tableView endUpdates];

            UIBarButtonItem *UndoButton = [[UIBarButtonItem alloc] initWithTitle:@"Undo" style:UIBarButtonItemStyleBordered target:self action:@selector(UndoAction:)];
            self.navigationItem.rightBarButtonItem=UndoButton;

        }];
        HideAction.backgroundColor = [UIColor blueColor];

        UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Delete"  handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
            //insert your deleteAction here



        }];
        deleteAction.backgroundColor = [UIColor redColor];
        return @[deleteAction,HideAction];

    }
    else
    {

        UITableViewRowAction *HideAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Hide" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
            //insert your editAction here
        }];
        HideAction.backgroundColor = [UIColor blueColor];
        return @[HideAction];

    }



}
</code></pre>
