I am seeing an issue with iOS 7. When I bring my UITableView in edit mode - I noticed that I can tap on multiple red "-" button to bring "Delete" option on multiple cells. When this happens I see below warning in console logs. Also, after some operations I am not able to tap on the "-" button.
Works fine in iOS 6.
Is this an iOS7 bug? Do anyone know the workaround for this?
attempting to set a swipe to delete cell when we already have one....that doesn't seem good`
- (BOOL)tableView:(UITableView *)iTableView canEditRowAtIndexPath:(NSIndexPath *)iIndexPath {
return (self.isEditMode) ? YES : NO;
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)aTableView editingStyleForRowAtIndexPath:(NSIndexPath *)iIndexPath {
return (iIndexPath.row !=0 && self.isEditMode) ? UITableViewCellEditingStyleDelete : UITableViewCellEditingStyleNone;
}
This is an issue with iOS 7 and shall be fixed in next iOS release. Have reported this to Apple.
I had this same bug until I changed my method to this:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
//remove the deleted object from your data source.
//If your data source is an NSMutableArray, do this
[self.array removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}
I hope this is helpful to somebody else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With