I\'m having some issues when deleting the last row of my (only) section in my tableView. Any other row works fine, but if I delete the row at the bottom of my <
Here is a solution I found to work well that builds upon jaydee3's answer:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
// hide cell, because animations are broken on ios7
double iosVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
if (iosVersion >= 7.0 && iosVersion <= 8.0) {
// Animating the cell's alpha change gives it a smooth transition
// Durations > .17 show the glitch on iPad, phone looks nice up to 0.3
[UIView animateWithDuration:0.17 animations:^(void) {
[tableView cellForRowAtIndexPath:indexPath].alpha = 0.0;
}];
}
NSArray *deleteIndexPaths = [[NSArray alloc] initWithObjects:indexPath, nil];
// UITableViewRowAnimationFade looks nice with the animation imho
[tableView deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationFade];
}
}