I am having a problem differentiating between two NSTableViews and could use some help.
I have tried these approaches:
1.
- (void)tableViewSelectionDidChange:(NSNotification *)notification {
if ([[notification object] tag] == 0) {
NSInteger row = [self.categoryTableView selectedRow];
...do stuff
} else {
if ([[notification object] tag] == 1 ) {
[self showItemSheet:self];
}
}
}
and 2:
- (void)tableViewSelectionDidChange:(NSNotification *)notification {
if ([notification object] == categoryTableView) {
NSInteger row = [self.categoryTableView selectedRow];
..do stuff
} else {
if ([notification object] == itemTable ) {
[self showItemSheet:self];
}
}
}
Both approaches work - most of the time. However, if I keep selecting from the tableview with tag 0, every three or four clicks and I see the itemSheet table initiated.
Can you try using a delegate method instead of the notification to achieve what you want? From the code above everything looks fine so probably the error is elsewhere?