Animation issue when deleting the last row of UITableView

Kevin Sliech

UPDATE: This is now fixed in iOS 8.0 and above. See my accepted answer for details.

I have an iOS 7 UITableView that I allow swipe-to-delete on rows. I'm handling deletions in:

tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

With:

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

All rows are deleted with the correct animation, except for the last one in the table. When the user swipes to show the delete button, then taps it, the cell slides completely off screen to the left but leaves a white cell behind with the delete button still on it for a few tenths of a second before disappearing abruptly. It appears that this is happening with all the cells, but all other cells have a row below them that slides up, covering it up.

This even happens when the row in question is the only row in the table, where I delete the entire section instead of just the row. The section header slides up into oblivion but the white cell with the delete button sticks around for a little bit.

I would like this last cell to have the same UITableViewRowAnimationTop animation that the others do. Any ideas of what's going on?

Kevin Sliech

UPDATE: This bug has been corrected in iOS 8. That final cell deletion now slides off to the left, the delete button slides up and away, and the background is clear (no more white area that abruptly disappears after the animations complete). The iOS 7 fix below is still needed when running below iOS 8.

iOS 7 Fix: I was able to correct this problem by adding another section to the end of the table with a sufficiently tall section header view. This header view is styled to look like the blank area at the bottom of the table, so you can't see that it's there. When the last row of the table is deleted, this blank section header slides up and over it, hiding the delete button that's stuck there. This is a bit of a hack, but it looks like it's a table view bug.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Weird UITableView insert/delete row animation

From Dev

iOS7 deleteSections:withRowAnimation: animation bug when deleting last section

From Dev

Animation issue when deleting the last row of UITableView

From Dev

problems with animation when deleting the last row of a TableView in ios7

From Dev

UITableView row separator issue

From Dev

Error when deleting a row in a row sorted JTable

From Dev

UITableView row delete animation flickers on iOS 7

From Dev

Having issue deleting a specific row in datatables

From Dev

The row doesn't fade away in UITableView when deleting

From Dev

Trigger error when deleting row

From Dev

Issue when deleting a nested model with minimum

From Dev

app crash while deleting row from within uitableview cellForRowAtIndexPath delegate

From Dev

UITableView indexPath of last row

From Dev

UITableView deleting row reduced table row height

From Dev

TokenMismatchException when deleting a row in db

From Dev

UITableView Deleting Row. Swift 2

From Dev

Expand and Collapse animation flickering issue in UITableview when reload UITableViewCell on every 1 sec

From Dev

Always deleting last row of table in MVC View

From Dev

iOS - deleting row from UITableView doesn't animate

From Dev

UITableView indexPath.row issue

From Dev

Last selected Row in UITableView

From Dev

Crash when deleting row and tableView

From Dev

Get the index path of last row in UITableView

From Dev

UIKit crash when deleting / inserting rows into UITableView

From Dev

NSRangeException when deleting last UICollectionViewCell

From Dev

Deleting first row and adding element to last row iny MySQL

From Dev

UIPageViewController shows an animation in the wrong direction when deleting the last photo

From Dev

UITableview view reload animation issue

From Dev

SwipeCellKit deleting last row in tableView create an error

Related Related

  1. 1

    Weird UITableView insert/delete row animation

  2. 2

    iOS7 deleteSections:withRowAnimation: animation bug when deleting last section

  3. 3

    Animation issue when deleting the last row of UITableView

  4. 4

    problems with animation when deleting the last row of a TableView in ios7

  5. 5

    UITableView row separator issue

  6. 6

    Error when deleting a row in a row sorted JTable

  7. 7

    UITableView row delete animation flickers on iOS 7

  8. 8

    Having issue deleting a specific row in datatables

  9. 9

    The row doesn't fade away in UITableView when deleting

  10. 10

    Trigger error when deleting row

  11. 11

    Issue when deleting a nested model with minimum

  12. 12

    app crash while deleting row from within uitableview cellForRowAtIndexPath delegate

  13. 13

    UITableView indexPath of last row

  14. 14

    UITableView deleting row reduced table row height

  15. 15

    TokenMismatchException when deleting a row in db

  16. 16

    UITableView Deleting Row. Swift 2

  17. 17

    Expand and Collapse animation flickering issue in UITableview when reload UITableViewCell on every 1 sec

  18. 18

    Always deleting last row of table in MVC View

  19. 19

    iOS - deleting row from UITableView doesn't animate

  20. 20

    UITableView indexPath.row issue

  21. 21

    Last selected Row in UITableView

  22. 22

    Crash when deleting row and tableView

  23. 23

    Get the index path of last row in UITableView

  24. 24

    UIKit crash when deleting / inserting rows into UITableView

  25. 25

    NSRangeException when deleting last UICollectionViewCell

  26. 26

    Deleting first row and adding element to last row iny MySQL

  27. 27

    UIPageViewController shows an animation in the wrong direction when deleting the last photo

  28. 28

    UITableview view reload animation issue

  29. 29

    SwipeCellKit deleting last row in tableView create an error

HotTag

Archive