• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: nibs,subclassing, nsviews
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >nibs,subclassing, nsviews (From: Jim Mooney <email@hidden>)

  • Prev by Date: Re: nibs, subclassing nsview
  • Next by Date: Links in NSTextField
  • Previous by thread: nibs,subclassing, nsviews
  • Next by thread: Links in NSTextField
  • Index(es):
    • Date
    • Thread