Re: nibs,subclassing, nsviews
Re: nibs,subclassing, nsviews
- Subject: Re: nibs,subclassing, nsviews
- From: Stephen Deken <email@hidden>
- Date: Thu, 24 Aug 2006 00:27:44 -0500
So Interface Building is unable to speak to a sole NSView subclass
which contains buttons and fields?
Interface Builder can do what you want, you just have to know how to
ask it properly.
Create a new, empty nib file to contain your custom view. Add the
view to that nib file along with all of its subviews. Then, to
instantiate a copy of that view (along with all of the designated
subviews), use this code:
MyViewController *cont = [[MyViewController alloc] init];
[NSBundle loadNibNamed:@"MyViewNib" owner:cont];
// [cont view] now contains a reference to the view
In theory, you could use this in your view's awakeFromNib: method to
replace the view with a copy that has all of the subviews attached.
Why does interface builder allow you to add stuff into an NSView
when it is not attached to a window?
Because standalone NSViews can also be used as sheets and drawers.
--sjd;
_______________________________________________
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