FROM : Ondra Cada
DATE : Fri Apr 22 03:35:30 2005
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
DATE : Fri Apr 22 03:35:30 2005
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 mails | Author | Date |
|---|---|---|
| Julien Palmas | Apr 21, 11:05 | |
| Dirk van Oosterbos… | Apr 21, 13:49 | |
| Julien Palmas | Apr 22, 02:26 | |
| Ondra Cada | Apr 22, 03:35 | |
| Julien Palmas | Apr 22, 08:44 | |
| j o a r | Apr 22, 09:22 | |
| Ondra Cada | Apr 22, 12:30 |






Cocoa mail archive

