Skip navigation.
 
mlRe: Memory management with nibs
FROM : Julien Palmas
DATE : Fri Apr 22 08:44:52 2005

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_removed>              http://www.ocs.cz
> private        <email_removed>            http://www.ocs.cz/oc
>

Related mailsAuthorDate
mlMemory management with nibs Julien Palmas Apr 21, 11:05
mlRe: Memory management with nibs Dirk van Oosterbos… Apr 21, 13:49
mlRe: Memory management with nibs Julien Palmas Apr 22, 02:26
mlRe: Memory management with nibs Ondra Cada Apr 22, 03:35
mlRe: Memory management with nibs Julien Palmas Apr 22, 08:44
mlRe: Memory management with nibs j o a r Apr 22, 09:22
mlRe: Memory management with nibs Ondra Cada Apr 22, 12:30