Initially I took an approach similar to most here using the seletedRow property in a method such as this one removeObjectAtIndex:[self.taskTable selectedRow]] however, I wanted a way to deleted multiple rows at once. This is possible via an index set (NSIndexSet) as shown:
[code]- (void)removeTask:(id)sender {
NSLog(@"Delete Task Button Clicked!");
// If no array, quit
if (!self.tasks) {
NSLog(@"No tasks to delete yet");
return;
}
NSIndexSet *selectedRows = self.taskTable.selectedRowIndexes; // using the selecteRowsIndexes property (an NSIndexSet)
[self.tasks removeObjectsAtIndexes:selectedRows]; // <-- remove indexset from array
[self.taskTable reloadData]; // refresh tableview
[self updateChangeCount:NSChangeDone];
}[/code]
Needless to say, you must edit the properties for the tableview in interface builder to allow for multiple selections