• 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: (no subject)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (no subject)


  • Subject: Re: (no subject)
  • From: Carlos Weber <email@hidden>
  • Date: Sun, 28 Apr 2002 09:42:45 -1000

On Sunday, April 28, 2002, at 01:19 , nicolas berloquin wrote:

Hi !

I'm new to the list and to cocoa. I've searched the archives but I didn't find anything relevant to my question, sooo here it goes:
I'm trying to do something that I thought would be really common with IB and cocoa:
I'd like to create an NSView or a custom view in IB, then, inside my code, "import" the view then insert it as a subview of some
other IB created view.
The IB FAQ says that one simply has to create a socket somewhere accessible and connect it to this view, but what if I need
multiple instances of this view ? (I'm planning to insert it many times in a scrollerview, or inside a matrix).
How does one clone a complete view hierarchy, then ?

I'm sure this is a very common task, could someone please forward me some pointers/snippets ?

It's been quite a while since you posted this question, but it doesn't look like anyone has really addressed it. If I understand what you want, here's how to accomplish it:

First, you need to create a new empty nib in IB. Then you will drag a "Custom View" widget from IB's palette and drop it onto your screen, just as you would if you were going to create a new window or panel. You'll see a Custom View icon appear in the nib's main window. This view will be the root of your view hierarchy, so you can now drag IB widgets (tableviews, buttons, etc etc) into the custom view and arrange them to your heart's content.

You will also need a NSView subclass, so that IB knows what particular "custom view" it's creating. You will also need a controller class, which IB must know about and which you should designate as the "File's Owner" (ask back if you don't understand how to accomplish this). Your controller class may need outlets to the UI objects in your view hierarchy, action methods for some of the UI objects, and some logic of its own.

Anyway, once you have all this, you have a package which can be brought to life with [NSBundle loadNibNamed: @"whateverYouNamedIt"], probably in the -init method of your controller. You can then instantiate as many of your controller/nib combinations as you want, and use them as you please.
_______________________________________________
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.
References: 
 >(no subject) (From: nicolas berloquin <email@hidden>)

  • Prev by Date: mamasam
  • Next by Date: NSTextField
  • Previous by thread: Re: (no subject)
  • Next by thread: compiled language
  • Index(es):
    • Date
    • Thread