For instance, I have a tableview on the subview. If the selection of this tableView changes, i want to enable a button on the windows's content view. Is it possible? If yes, please guide..
Thanks in advance..
There are few ways
You can set the object that creates the subview as a delegate for the tableview and implement tableViewSelectionDidChange
in that object.
Or you can subscribe to NSTableViewSelectionDidChangeNotification
notification, passing your tableView:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tableViewSelectionDidChange:) name:NSTableViewSelectionDidChangeNotification object:tableView];
and handle it in :
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification {
NSTableView *tableView = (NSTableView *)aNotification.object;
NSLog(@"selection changed: %i", [tableView selectedRow]);
}
精彩评论