I have a table view which I want to bring up in edit mode under some conditions.
I can set the table itself into editing mode with the following code:
[self.tableView setEditing:YES animated:YES];
But this view controller also has an editButtonItem, which comes up in normal mode, showing "Edit" on the button. I would like to set this button into Edit mode, so it shows "Done" and will toggle the entire table back to normal mode when selected. This button is set up with the typical:
self.navigationItem.rightBarButtonItem = self.editButtonItem;
Is there a way to toggle this button into edit mode programmatically? If I change the style of the button, it changes the appearance, but doesn't actually change the mode of the button.
With a little more research I answered my own question. I need to set both the table view and the view controller itself to editing mode - then the table, and the editButtonItem will both reflect the correct state. Like this:
[self.tableView setEditing:YES animated:YES];
[self setEditing:YES];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With