• 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: Memory management with nibs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory management with nibs


  • Subject: Re: Memory management with nibs
  • From: Julien Palmas <email@hidden>
  • Date: Fri, 22 Apr 2005 15:44:52 +0900

The nib handling abilities of a NSWindowController are pretty attractive and I would like to use a sub-class of it. Still, I only need one window per document and each different nib, like I said before, would only be there to provide other views.

Would it be bad to add a window inside each nib, just in order to use a sub-class of NSWindowController as its owner ? even if I completely don't care about this window ?

On Apr 22, 2005, at 10:35 AM, Ondra Cada wrote:

Julien,

On 22.4.2005, at 2:26, Julien Palmas wrote:

But I also have other nibs, one for each different piece of information present in the document. Let's say there are 50 different nibs, being able to load only 2 of them if necessary is much more efficient that always loading the 50 !!!

Definitely.

My question is about the file owner for those nibs. What class (sub class) should I use.

Some controller, appropriate by the app design. If the NIBs contain separate windows, an NSWindowController subclass looks kind of interesting ;) Otherwise, for separate views and similar, probably the controller of the window into which the NIB objects are to be placed, or something alike.


I don't want to make the NSDocument the file owner. And what should I do to make sure those nibs are correctly released once the document closed?

The simplest way: ensure releasing root-level NIB objects yourself. The best way probably is to do that from whatever controller is the NIB owner. Just don't forget to have an outlet for each root-level object, and release the outlet when the controller itself goes poof. Alternatively, for windows, you can just tell them to release when closed (in IB Inspector).


There are tricks to do that semi-automatically, but generally they are not worth the hassle. See 10.3 NSNib for the easiest one (at least, far as I know) via instantiateNibWithOwner:topLevelObjects:.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Memory management with nibs
      • From: j o a r <email@hidden>
References: 
 >Memory management with nibs (From: Julien Palmas <email@hidden>)
 >Re: Memory management with nibs (From: Dirk van Oosterbosch <email@hidden>)
 >Re: Memory management with nibs (From: Julien Palmas <email@hidden>)
 >Re: Memory management with nibs (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Printing issues
  • Next by Date: subversion support in XCode?
  • Previous by thread: Re: Memory management with nibs
  • Next by thread: Re: Memory management with nibs
  • Index(es):
    • Date
    • Thread