I want to be able to add 1 cell to the top of a UITableView after the user clicks on a button. How can I achieve this?
Update: I also want to hide the cell if the user clicks another button
I want to be able to add 1 cell to the top of a UITableView after the user clicks on a button. How can I achieve this?
Update: I also want to hide the cell if the user clicks another button
You can either call UITableView
's insertRowsAtIndexPaths:withRowAnimation:
to animate the insertion. Otherwise, you can just update your datasource without calling this method.
In order to do this you have to use the Navigation Controller, this is because once the user clicks the button your are suppose to send the user to a new view that edits and adds the new cell to the UITableView.