Steps to reproduce the issue.
- Launch the sample TableViewExample app.
- Perform right to left on any TableView row. (Please refer "RightToLeftSwipe1.png")
- Perform right to left on any other row. (Please refer "RightToLeftSwipe2.png")
- Now Tap on Edit button on top-right.
- Observer the result, one row is not in edit mode. (Please refer "EditScreen.png")
Expected Result: All rows should be in edit mode
Actual Result: One row is not in edit mode.
Source Code:
@interface ViewController ()
@property (strong, nonatomic) NSMutableArray *people;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.people = [NSMutableArray arrayWithObjects:@"One", @"Two", @"Three", @"Four", @"Five", @"Six", @"Seven", @"Eight", @"Nine", @"Ten", nil];
self.peopleTableView.delegate = self;
self.peopleTableView.dataSource = self;
self.navigationItem.rightBarButtonItem = [self editButtonItem];
//self.navigationItem.leftBarButtonItem = [self ];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.people count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if(nil == cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
cell.textLabel.text = [self.people objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
[self.people removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationFade];
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
self.peopleTableView.editing = editing;
}
@end