• 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: IB Instances
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IB Instances


  • Subject: Re: IB Instances
  • From: Jonathan Hess <email@hidden>
  • Date: Fri, 27 May 2005 11:28:22 -0700

Hey Theodore -

In Interface Builder, you design instances of objects and you serialize them into nib files. If you design a window, in one nib file, and connect that window up to other objects, then when you read that nib in at runtime, you'll get one new copy of all of those objects. They will all be connected in the fashion that you specified in IB. If you go on to open this nib several more times at run time with

+ [NSBundle loadNibNamed:(NSString *)aNibName owner:(id)owner]

You'll get one new copy of those objects each time. Creating instances of a class programatically has no direct relation to the instances you may have created in IB. You can think of IB as a tool that lets you create objects and connect them together and then save them to a file to be used later.

Be careful to realize that in interface builder you design instances, and not classes. In some other interface design tools, you actually define a class that you can instantiate over and over again with something like "AccountWindow window = new AccountWindow()" and you'll wind up with a new account window with all of the related widgets already in place. In IB, you design one instance, of AccountWindow, and read it over and over again with "+ [NSBundle loadNibNamed:(NSString *)aNibName owner:(id)owner]" if you need more than one copy. However, if you just said [[AccountWindow alloc] initWithContentRect:....] You'd only get the window, and none of it's connections or widgets would be in place.

Good Luck -
Jon Hess

On May 27, 2005, at 10:59 AM, Theodore H. Smith wrote:

Let's say I make some NSWindow instances with IBOutlets, and connect them in IB.

Then let's say I make a few of these windows in my compiled app.

What happens to the connections and the instances? Do I get multiple instances of everything defined in that nib, all connected to each other? Or does only the window get multiple instances, and then we have a many-to-one relationship with the connections?

Or something else?

As always, forward me the appropriate docs, as I'm not sure where to look for information on instances right here.


-- elfdata.com/plugin/ Industrial strength string processing, made easy.

"All things are logical. Putting free-will in the slot for premises in
a logical system, makes all of life both understandable, and free."

_______________________________________________
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


_______________________________________________ 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: 
 >IB Instances (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: How to get NSTableView to notice a change in NSTableDataModel
  • Next by Date: Re: IB Instances
  • Previous by thread: Re: IB Instances
  • Next by thread: How to get NSTableView to notice a change in NSTableDataModel
  • Index(es):
    • Date
    • Thread