Re: Memory management with nibs
Re: Memory management with nibs
- Subject: Re: Memory management with nibs
- From: Ondra Cada <email@hidden>
- Date: Fri, 22 Apr 2005 03:35:30 +0200
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