Adding Cells

Recipe 9-3 uses an Add button to create new content for the table. This button takes the form of a system bar button item, which displays as a plus sign. (See the top-left corner of Figure 9-5.) The addItem: method in Recipe 9-3 appends a new random image at the end of the items array.

Recipe 9-3 Editing Tables

@implementation TestBedViewController {     NSMutableArray *items; } #pragma mark Data Source // Number of sections - (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView {     return 1; } // Rows per section - (NSInteger)tableView:(UITableView *)aTableView     numberOfRowsInSection:(NSInteger)section {     return items.count; } // Return a cell for the index path - (UITableViewCell ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.