Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView Edit/Done events

Is there a notification or delegate method that I can use to detect when the table view goes into the editing state?

What I want to do is detect that the table is editing and then display an extra row that says "Add new item" or something like that.

I tried adding the "Add New Item" row at the end of the array when the View Controller is loaded and then depending on whether [tableView isEditing] is true or not, either return [array count] (for when I am editing) or [array count] - 1 (for when I am not editing).

Any ideas? What is the way Apple edits items in the table and allows for deletion?

like image 460
rplankenhorn Avatar asked Dec 14 '10 21:12

rplankenhorn


1 Answers

I found it. Override this method:

- (void)setEditing:(BOOL)editing animated:(BOOL)animated{
    [super setEditing:editing animated:animated];

    // do something
}
like image 181
rplankenhorn Avatar answered Sep 28 '22 22:09

rplankenhorn