How can I animate my "removal of tableviewitems" when the user changes between segments in the UISegmentControl?

The behaviour should be similar to "Missed/All" calls in the Phone App.

No correct solution


The deleteRowsAtIndexPaths:withRowAnimation: and insertRowsAtIndexPaths:withRowAnimation: will provide the animation for you.

If you need to perform a more complex operation (inserts and deletes), you start a block. similar to a UIView animation block:

[tableView beginUpdates];

//add and delete

[tableView endUpdates];

Bear in mind you will need to update the model to reflect the changes in the table.

UITableView can be sent a message: deleteRowsAtIndexPaths:withRowAnimation: The withRowAnimation argument determines the type of animatio that will be used in removing the cell.

I don't know if any of those animations match the missed/all functionality exactly though. If they don't, I'm guessing you will have to set up an animation to collapse the height of the cells before removing them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow