I’m building an app where a user is able to provide different usernames that he/she has. The vision is, the user is able to add and remove UITableViewCell to enter a username.
Right now I have a grouped UITableView and on the right hand side of every UITableViewCell I have a UIButton that adds another cell to the table with a UITextField. After the first cell, every cell has a delete button. I’m trying to make the UIButton delete that row. I have the IBAction that removes the cell, the only problem is, it’s not deleting the proper row.
What is the best way to do what I’m attempting to do? I don’t know how to properly search for this on Google. I’m sure someone has done what I’m trying to do.
Thanks for any help in advance!
Similar to what Derek said above —
UITableViewControlleralready provides functionality to delete rows.To toggle editing a
UITableView, do something like:[self.tableView setEditing:!self.tableView.editing animated:YES];Override
tableView:canEditRowAtIndexPath:with something like (since it sounds like you don’t want your first row to be deletable):Also override
tableView:commitEditingStyle:Hope this helps!