Re: instantiateNibWithOwner:topLevelObjects: usage
Re: instantiateNibWithOwner:topLevelObjects: usage
- Subject: Re: instantiateNibWithOwner:topLevelObjects: usage
- From: Ricky Sharp <email@hidden>
- Date: Fri, 2 Dec 2005 16:11:38 -0600
On Nov 30, 2005, at 4:06 PM, Ricky Sharp wrote:
I've decided to take a different approach with my nib handling for
my kiosk-based apps.
After reading various threads about nib-loading and releasing top-
level objects, I've found that I need to take an even different
approach.
While I was able to obtain NSArrays filled with top-level objects,
analyzing the dependencies between the objects pointed out what
appeared to be many circular situations. And, releasing the nib's
owner (a controller), didn't end up calling dealloc on the controller
since bound objects were referencing the controller.
So, while it's really nice to be able to call
instantiateNibWithOwner:topLevelObects: (which loads things from a
nib already in memory, rewires bindings, etc.), I was leaking memory
since many top-level objects were never dealloc'd. Many of the
objects had refcounts of 3 or more even _after_ I sent them a release
message.
It seems that Dennis De Mars had similar issues as seen in this thread:
<
http://www.cocoabuilder.com/archive/message/cocoa/2004/6/12/109600>
A workaround seems to be to use an NSWindowController (or subclass)
to control the nib, but to _not_ have that object be the nib's owner.
When I find a solution to all this, I'll post back here. My hope is
to have a nice recipe for apps that store windows in multiple nibs,
yet those windows are not controlled by a window controller. This is
probably the exception to the rule, but I'm finding that this setup
is working out the best for me in my kiosk-style apps.
___________________________________________________________
Ricky A. Sharp
mailto:email@hidden
Instant Interactive(tm)
http://www.instantinteractive.com
_______________________________________________
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