Syed Absar
Syed Absar

Reputation: 2284

Edit Mode in UITableView

So i've implemented the

- (BOOL)tableView:(UITableView *)tableView
canEditRowAtIndexPath:(NSIndexPath *)indexPath

and

- (void)tableView:(UITableView *)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath

but how will i trigger something to switch the tableview to edit mode? like the messages in iphone when you click edit, the delete icons appear. this might sound very basic but i'm getting no clue over this and its a little urgent, any clue will be appreciated, thanks.

Upvotes: 3

Views: 3579

Answers (2)

Aram Kocharyan
Aram Kocharyan

Reputation: 20431

You can also use a navigation controller and load your table view in there. Then just assign an edit button to the left navigation bar item and it will toggle editing for you.

// in the table viewDidLoad

self.navigationItem.rightBarButtonItem = self.editButtonItem;

Upvotes: 2

Alex Wayne
Alex Wayne

Reputation: 187302

[tableView setEditing:YES animated:YES];

Upvotes: 5

Related Questions