'Clear table using a button in objective-c
I'm trying to clear all from a table using a button. Basically reset the table. I use the following to remove one slice at a time but how do I clear all from the table? Thank you in advance!
- (IBAction)handleRemoveSliceTapped:(NSButton *)sender {
NSInteger selectedRow = [self.sliceTable selectedRow];
if (selectedRow < 0) {
return;
}
if ([self.sliceTimes count] == 0) {
return;
}
NSIndexSet *removalSet = [NSIndexSet indexSetWithIndex:selectedRow];
[self.sliceTable removeRowsAtIndexes:removalSet withAnimation:NSTableViewAnimationSlideUp];
[self.sliceTimes removeObjectAtIndex:selectedRow];
[self.sliceTable reloadData];
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
