I am trying to change the order of a particular group of cells in a particular section of UITableView with static content. I am trying to do this before the view loads, but for some reason I cannot get it to work.
I have tried creating reference outlets for each of the cells and then calling tableView.moveRow by calling in tableView.indexPath(for: cell1
I have also tried giving each a tag and looping through the cells in that section and reordering with with no success.
I have tried:
// Moving the row from it's default row
self.tableView.moveRow(at: IndexPath(row: 1, section: 1), to: IndexPath(row: newRow, section: 1))
// Creating a reference outlet called cell1
self.tableView.moveRow(at: self.tableView.indexPath(for: cell1)!, to: IndexPath(row: newRow, section: 1))
// Giving the static cell a reuseidentifier in interface builder
self.tableView.dequeueReusableCell(withIdentifier: "Cell1", for: IndexPath(row: self.subwayOrder+1, section: 1))
Depending on what you're trying to achieve, you could possibly have success switching index paths in
cellForRow by calling super's implementation.