• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Controller does not contain associated window after initialization
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Controller does not contain associated window after initialization


  • Subject: Re: Controller does not contain associated window after initialization
  • From: Graham Cox <email@hidden>
  • Date: Wed, 2 Dec 2009 01:48:22 +1100

On 02/12/2009, at 1:31 AM, Bryan Zarnett wrote:

> I am creating an application with multiple NIB files.  I created an empty NIB, put down a new window and  added an Object for the controller. I wired the controller object to the window and the nib as well as a few actions.
>
> In my controller class I have added the following:
>
> if (self = [super init])
> {
>  [NSBundle loadNibNamed:@"CreateSheets.xib" owner:self];
>  NSLog(@"The sheet is %@",[self sheet]);
> }
>
> The sheet is always null. Are there any specific steps I need to do, when working with multiple NIBS to:
>
> 1) Load the controller for a specific NIB.
> 2) Set the window in the NIB to the controller
> 3) Use the new controller in another controller.
>
> For reference, I have my "MainController" which instantiates the "SecondController" and uses the window.
>
> Thoughts?


Do it the conventional way. Subclass NSWindowController and make that File's Owner for the nib. It will deal with instantiating and loading the window lazily for you. If there are aspects of a controller that you want to reuse but don't fit with NSWindowController, make that a subcontroller of the NSWindowController.

I can't quite follow what you've done above. It appears as if you are trying to load the nib that contains the object that is trying to load the nib. Cart before horse?

--Graham_______________________________________________

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

  • Follow-Ups:
    • Re: Controller does not contain associated window after initialization
      • From: Bryan Zarnett <email@hidden>
References: 
 >Controller does not contain associated window after initialization (From: Bryan Zarnett <email@hidden>)

  • Prev by Date: Controller does not contain associated window after initialization
  • Next by Date: Please ask clearer questions [Re: NSString out of scope]
  • Previous by thread: Controller does not contain associated window after initialization
  • Next by thread: Re: Controller does not contain associated window after initialization
  • Index(es):
    • Date
    • Thread