Reputation: 7293
I have a tableView and two buttons. One to add a row, and one to remove a row(selected).
Upvotes: 2
Views: 3500
Reputation: 46533
If you are looking for Mac OSX :
You can use two ways, in both the cases you deal with the model not the view : ArrayController using Binding and Conventional Programming.
1 How would I add a row of textbox cells?
//in the IBAction of add button
[yourModelArray addObject:newObject];
[yourTableView reloadData];
2 Also, how would i remove the selected row?
//in the IBAction of remove button
[yourModelArray removeObjectAtIndex:[yourTableView selectedRow];
[yourTableView reloadData];
3 Would it be possible for the user to select a row, not just individual cells?
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:1];
[yourTableview selectRowIndexes:indexSet byExtendingSelection:NO];
//If you want to select multiple rows, use YES.
Upvotes: 6