开发者

Edit Mode in UITableView

开发者 https://www.devze.com 2023-02-03 08:52 出处:网络
So i\'ve implemented the - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消