I have been practicing with tableViews but I cannot figure out how to insert new items when a button is clicked.
This is what I have:
BIDViewControlle
You are doing it right,
- (IBAction)addItems:(id)sender {
// I thought it was as simple as this, but it doesn't work
[self.names addObject:@"Brad"];
[self.tableView relaodData];
}
is the correct way.
Please double check the variable tableView, I can't see the declaration of it.
make sure you have,
@property(weak, nonatomic) IBOutlet UITableView *tableView;
[self.tableView setDelegate:self];
[self.tableView setDataSource:self];
and properly connected the tableView to .nib