Adding Rows
There are a number of ways to add rows to a table view at runtime. The built-in behavior for adding a row is to display a new row with a green plus sign icon. However, this technique has fallen out of favor because it’s cumbersome to enter editing mode and then find the row with the plus sign icon – especially in large tables.
So we’re going to use the New button in the header view instead. When this button is tapped, a new row will be added to the UITableView. In ItemsViewController.m, implement addNewItem:.
- (IBAction)addNewItem:(id)sender { // Make a new index path for the 0th section, last row int lastRow = [[self ...
Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.