Swipe to delete without working in edit mode

I had the following problem.

I have an application using a UITableView with a custom UITableViewCell. Due to the specifications of the application, I need it to be in edit mode always , so on viewDidLoad I wrote this:

- (void)viewDidLoad
{
    MainTableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"compose_background.png"]];
    [MainTableView setAllowsSelectionDuringEditing: TRUE];
    [MainTableView setEditing: TRUE];

    [super viewDidLoad];    
}

In addition, I applied the following methods:

- (UITableViewCellEditingStyle) tableView:(UITableView *)tableView  editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
- (BOOL) tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
- (void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

And a few more, but the problem persists, and when I scroll through the cell, the delete button does not appear. Any pointers would be very vulnerable.

+5
source share
2 answers

- (UITableViewCellEditingStyle) tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPathshould return UITableViewCellEditingStyleDeletefor every row you want to delete. Scrolling to delete is disabled in favor of this method in edit mode.

+9

, , , .

+1

All Articles