• 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: NSDoc and Memory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDoc and Memory


  • Subject: Re: NSDoc and Memory
  • From: James DiPalma <email@hidden>
  • Date: Sat, 7 Sep 2002 16:28:59 -0400

From: Bill Cheeseman <email@hidden>

From Ricky Heywood at email@hidden

How can a NSDocument get its corresponding window at run time? There is an
IBOutlet called window but you do you get to it since it isn't explicitly
entered into my subclass of NSDocument (CheckRegController.h/m)

NSDocument does NOT have an IBOutlet named "window." What you're probably
seeing in IB is NSWindowController's IBOutlet named "window" -- assuming
your nib's File's Owner is a subclass of NSWindowController.


Be careful; NSDocument and NSWindowController are confusing enough and you shouldn't assume that everyone programs according to your guidelines in Vermont Recipes especially when a new "Cocoa Document-based Application" from PB does set MyDocument.nib's file's owner class to MyDocument and that NSDocument actually does have an IBOutlet named window.

You can verify this information in IB or by looking in NSDocument's header on 10.1.5; notice these lines:
-------------
- (void)setWindow:(NSWindow *)window;
// This method is for getting the window outlet hooked up from IB in the case where the document is the nib file's owner (ie if the document implements -windowNibName).
-------------

If your document has only one window, you don't have to track its window controller but can instead just refer to the first (and only) window controller in the array: [[[self windowControllers] objectAtIndex:0] window].

Bill Cheesman's answer here probably solved Ricky's original question.


-jim
_______________________________________________
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.

  • Follow-Ups:
    • Re: NSDoc and Memory
      • From: Bill Cheeseman <email@hidden>
References: 
 >Re: NSDoc and Memory (From: Bill Cheeseman <email@hidden>)

  • Prev by Date: Document Based (I'm semi lost!)
  • Next by Date: Print NSTableViews
  • Previous by thread: Re: NSDoc and Memory
  • Next by thread: Re: NSDoc and Memory
  • Index(es):
    • Date
    • Thread