topgun
topgun

Reputation: 2573

UITableView Edit Mode by default

I am trying to have a tableView which have edit button to remove cells by default. Is there anyway to achieve that rather than selecting edit button and then to get to edit mode?

Thanks

Upvotes: 1

Views: 1394

Answers (2)

XJones
XJones

Reputation: 21967

Editing mode is a state of the UITableView. You can set it programmatically with:

[tableView setEditing:YES animated:YES]

You can do this anytime, with or without animation.

Upvotes: 4

jrturton
jrturton

Reputation: 119242

Set the table view to editing mode as soon as it appears. In your viewWillAppear method:

self.tableView.editing = YES;

Upvotes: 1

Related Questions