Reodering rows across sections

Hi

In my app I have 2 sections, a Playing section and also a Substitute section. I’ve managed to get my table to be reordered. But I’m thinking of how I can stop a user reordering all the cells so everyone is playing. In my case I need a max of 11 players. How would I build this so I can not move more than 11 rows into the playing section?

Are you using the normal reordering controls?

Take a look at the canMoveRowAt method of the UITableViewDelegate protocol.

     optional func tableView(_ tableView: UITableView, 
                canMoveRowAt indexPath: IndexPath) -> Bool

You can use that method to determine whether the reordering control should be displayed for a given cell.

Have fun!

1 Like

Thanks I will have a look at this and see what I can do with this. Slowly I’m learning methods available for iOS - it’s just so vast