On Jun 11, 2009, at 15:53, Brad Gibbs wrote:

I had been manually instantiating the view controllers and passing references to the main window controller and the main managed object context with a custom init method ( initWithMoc: andWindowController:) and using these arguments to set variables in the view controllers. Today, I decided to try to refactor and clean up some code by instantiating the view controllers in nibs, but I ran into the problem I'm trying to describe.

It may just be prejudice, but I'm not a fan of putting window controllers or view controllers in nib files. And if your view controllers are all in the same nib, you lose the benefit of only instantiating the view controllers you need at any given time. Nevertheless ...

So you have a single window nib file? And a separate nib file for each view that can be displayed in the window "content" area? Are the view controllers in the window nib file? Somewhere else?

I still think the answer is likely to be that the objects in your view nib need to use mViewController.mainWindowController instead of mMainWindowController, and that your in-nib view controllers need an outlet connected to the main window controller (supplying the value of the view controller's mainWindowController property) instead of a plain instance variable.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to