I have a table view where I'd like to deselect either the previously selected cell when returning to it from a detail view or the newly added cell when the user creates an item.
However, since sometimes new items are added, the table is refreshed by calling reloadData
in viewWillAppear:
. This means none of the cells are selected when the view appears, even if I have self.clearsSelectionOnViewWillAppear = NO
.
By selecting and deselecting the cell after the table view appears (in viewDidAppear:
) the timing of the deselect animation is visibly different to the user (try for yourself, it's slower and doesn't feel as slick).
How should I be preserving the selection even after the table view is refreshed? (Please keep in mind, depending on the situation, I'd like the deselect either the previously selected cell or the newly created cell.) Or should somehow I be reloading the data in my table differently?