Re: progress sheet and a NIB file
Re: progress sheet and a NIB file
- Subject: Re: progress sheet and a NIB file
- From: Sherm Pendley <email@hidden>
- Date: Wed, 28 Sep 2005 01:13:25 -0400
On Sep 28, 2005, at 12:41 AM, Paul J. Lucas wrote:
I'm trying to code a sheet that shows a progress indicator. I
have a panel in a NIB file that I load like:
NSNib *const nib = [NSNib alloc];
[nib initWithContentsOfURL:[NSURL fileURLWithPath:nibPath]];
Initializer methods are allowed to return an object other than one
they were called on, or even nil. It's better to use [[NSNib alloc]
init ...], but if you really want to separate them, you *must* store
the value returned by -init*, instead of just throwing it away as above.
NSNib *nib = [NSNib alloc];
nib = [nib initWithContentsOfURL: [NSURL fileURLWithPath:nibPath]];
I then need to instantiate it:
NSMutableArray *topLevelObjects;
[nib instantiateNibWithOwner:???? topLevelObjects:&topLevelObjects];
The question is: what object do I use as the owner?
Any object you like. Quite often, it's an instance of
NSWindowController (or a subclass), but that's not required, just
convenient. You can tell IB about the owner's class by selecting
"File's Owner" and choosing a class in the "Custom Class" info pane.
Outlets and actions that you connect to "File's Owner" in IB will be
connected to the owner object you supply here.
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
_______________________________________________
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