Re: Interface builder, .nibs, etc ...
Re: Interface builder, .nibs, etc ...
- Subject: Re: Interface builder, .nibs, etc ...
- From: Dustin Voss <email@hidden>
- Date: Tue, 16 Dec 2003 17:21:36 -0800
On 16 Dec, 2003, at 1:24 PM, Stiphane Sudre wrote:
Just drag a custom view instead of a window. And it will be your root
widget that you will be able to add dynamically to the Inspector
Window.
To expand on this answer, I have built view controllers analogous to
window controllers, where the view controller is the owner of a
view-only NIB. I only need to use this technique because I put the view
in its own NIB and make multiple instances of it programatically. If
you only need one instance of the view, it'd be easier to put in in the
inspector window's NIB.
I use NSNib to pre-load the NIB and instantiate it as many times as I
need to. Each time I instantiate it, I use a new controller object as
the file owner. NSNib sets all the outlets of the controller object.
One of the outlets is for the view itself. I use that outlet to add the
view to its superview.
The only problem I've found is in managing the lifetime of the NIB's
top-level objects. Apparently, once the view is added to its superview,
the view controller can no longer release it, and I get a (seemingly
harmless) malloc error. It is curious, and I worry about memory leaks.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.