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: Jonathan Hess <email@hidden>
- Date: Fri, 12 Sep 2008 13:38:41 -0700
Hey Brad -
So it sounds like you have two controllers, A, and B, and they each
have their own NIB. Sound like you're on the right track. Now you want
to have an action in B's NIB affect controller A. Does controller B
have an instance variable, or other mechanism, for referencing
controller A? If so, you could put an action method on controller B
and have that be the target of your button in NIB B. The
implementation of that action can then call a method on controller A.
Jon Hess
On Sep 12, 2008, at 12:17 PM, Brad Gibbs wrote:
I'm working on an application with a single main window and a number
of views and view controllers. I have a navigation window that pops
up and allows users to set preferences and also switch views in the
main portion of the app's main window.
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.
The main window and its window controller are instantiated when the
program is launched. Creating another instance in the view
controller that contains the buttons (either by adding a
MainWindowController object in IB or by creating another instance in
the view controller code) doesn't target the existing main window,
and, therefore, doesn't cause views to be switched in the main
window that is instantiated on launch. So, how can I target the
instance of the main window controller that was instantiated on
launch from the NSViewController controlling the view with the view
switching buttons, in order to switch views? Or should I be doing
something else entirely?
Thanks.
Brad
_______________________________________________
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
_______________________________________________
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