Dynamically add a new row as Add in UITableView in edit mode?
Posted
by David.Chu.ca
on Stack Overflow
See other posts from Stack Overflow
or by David.Chu.ca
Published on 2010-04-04T21:09:35Z
Indexed on
2010/04/04
21:13 UTC
Read the original article
Hit count: 366
iphone
I have a table view with 0 or n rows of data from datastore. I added a customized Edit button on the right of the view's navigation bar. By default, when the edit button is clicked, in the action event, I set the view as edit mode:
[self.tableView setEditing:YES animated:YES];
I would like to add a row at the end of the table view with Add button as an accessory on the left when the table view is in edit mode. And the "Add" row will not be displayed when the view is not in edit mode. This is very similar to the case of iPhon'e Contacts application when a contact is in edit mode.
I am not sure if I need to add a row dynamically, and how if so? An alternative way I guess is to add more row when tableView:numberOfRowsInSection: is called? If later is the case, I have to make it hidden when the view is not in edit mode and visible when the view is in edit.
© Stack Overflow or respective owner