Re: Communicating with NSTableView delegate
Re: Communicating with NSTableView delegate
- Subject: Re: Communicating with NSTableView delegate
- From: Nick Zitzmann <email@hidden>
- Date: Mon, 12 Apr 2004 08:18:13 -0600
On Apr 12, 2004, at 7:16 AM, aperantos lists wrote:
ISSUE: When a row is selected in the table view I want my main object
(not sure of the correct vernacular but it is the subclass of
NSPreferencePane) to check the table to see what is selected and load
the appropriate file. I believe I need to use the
tableViewSelectionDidChange delegate method, but how do I get this
method to communicate back to the main object?
You can use the notification center to do that. Put something like this
in your main object:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(tvSelectorDidChange:)
name:NSTableViewSelectionDidChangeNotification object:myTable];
Replace the selector name with whatever method you want to be called
when the selection changes.
Is the only way to
register with a notification center, or is there a way to 'find' the
main object?
I suppose you could also give the main object a singleton accessor, but
in this case using the notification center is easier...
Nick Zitzmann
<
http://www.chronosnet.com/>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.