Re: Detail view beginner question
Re: Detail view beginner question
- Subject: Re: Detail view beginner question
- From: Stéphane Sudre <email@hidden>
- Date: Thu, 17 Jun 2004 14:34:38 +0200
On Jun 17, 2004, at 2:23 PM, Yann Bizeul wrote:
Now the question is: Is it better to have a second controller class
for that window (in the future i will have two or three slightly
different objects in the table and want to adapt the info-window
accordantly ) and how I connect the text fields in the info window
with my tableview.
If you need different windows for each kind of information you show in
the TableView, and depending how often and when you would need these
windows, perhaps I would choose to have a nib for each item type.
The nib owner would be a NSWindowController subclass, responsible of
getting current objet and display/update it's infos.
Now how to get the current object ? I'm asking assistance of more
skilled OOP people, bacause myself will hesistate between different,
more or less clean, solutions (Be indulgent, I'm reading a book on
Design Patterns !) :
- Have CurrentObjectController singleton shared for the whole
application
- Subclass NSApplication and add a -(id)currentObject method
- add an initialization method to your NSWindowController subclass like
this :
- (NSWindowController*)initWithWindowNibName:(NSString*)aName
object:(MyObject*)anObject
...
In this kind of situation, a solution could be:
- One controller for the Info-window
- Communicate selection modifications to the Info-window controller via
NSNotification (you just need to provide the selected object(s)).
- Work on this object in the Info-window.
- Send back a Notification to the other controller via a notification.
_______________________________________________
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.