Re: Newb: Targeting an instance of a class instantiated by a NIB file
Re: Newb: Targeting an instance of a class instantiated by a NIB file
- Subject: Re: Newb: Targeting an instance of a class instantiated by a NIB file
- From: Brad Gibbs <email@hidden>
- Date: Fri, 12 Sep 2008 13:30:38 -0700
Thanks for the reply. Unfortunately, the navigation panel is too
complicated not to have a controller (it has several, actually). I
haven't used the responder chain yet, but I'll give it a go. It's
disappointing that there's no way to target the instance directly...
On Sep 12, 2008, at 12:41 PM, Jamie Hardt wrote:
On Sep 12, 2008, at 12:17 PM, Brad Gibbs wrote:
I want to write the code to switch views in the
MainWindowController.m, since it controls the window that contains
the views that will be switched. But, the buttons that control the
view switching are located on a panel being controlled by a
different view controller.
So you have the buttons on the navigation panel, that control the
main window view. You have a few options:
1) Connect the buttons on the panel to the changeView: (or whatever
you call it) actions on the main window windowController. This is
the easiest. Just leave your Navigation Panel in your main windows
nib, and don't bother writing a window controller for it. If the
navigation panel starts getting more complicated and chatty with a
bunch of other components, or particularly if it can alter document
state, THEN consider making a separate NIB for it.
2) Implement changeView: on your Document class instead, and make
the buttons on the panel send a changeView: selector to the first
responder. The changeView: message will eventually find its way to
your NSDocument, and then you write code in the NSDocument that
tells the MainWindowController to do the view switching. All roads
in the responder chain lead to the NSDocument eventually.
Jamie Hardt
The Sound Department
http://www.soundepartment.com/
http://www.imdb.com/name/nm0362504/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden