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 me开发者_JS百科ssages 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.
[tableView setEditing:YES animated:YES];
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;
精彩评论