UITableView multiple selection update rows

by Deepak Sharma   Last Updated September 11, 2019 17:26 PM

I have UITableView in editing mode with check mark accessory. After selecting few rows and completing an action (such as saving the files/images identified by rows to a server), I update the highlighted cells as follows:

 if let indexPaths = tableView.indexPathsForSelectedRows {
            tableView.reloadRows(at: indexPaths, with: .none)
 }

Problem: All the checkmarks in the accessory view are gone, plus rows are no more highlighed, once the update finishes. How do I preserve row highlights and check mark accessory?



Answers 1


What appears to be happening here is that you are updating every row's accessory with .none. You might want to write a boolean test the accessory of a row before you update it with .none

Michael M.
Michael M.
September 11, 2019 17:25 PM

Related Questions


Updated May 18, 2017 14:26 PM

Updated June 06, 2017 11:26 AM

Updated June 30, 2017 01:26 AM

Updated June 25, 2018 01:26 AM

Updated December 13, 2018 15:26 PM