• 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: Interface Builder Outlets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interface Builder Outlets


  • Subject: Re: Interface Builder Outlets
  • From: John Pannell <email@hidden>
  • Date: Thu, 15 Dec 2005 15:19:09 -0700

Hi Johnathan-

The short answer is no. In code, you let your objects know in their ivars that you are going to be using IB to connect them. So if you had an object (an instance of MyObject, lets say) that needed to know about one of its views (an instance of MyView), then in your header you would have...

@interface MyObject : NSObject {
IBOutlet MyView *superCoolView;
}

The "IBOutlet" keyword lets the compiler(?) know that the connection is being established in IB.

Any object (a window, a view, a button) you drag/drop into IB is already alloc'ed and init'ed. I don't really think of outlets as being objects, per se, but rather a substitute for alloc/init. If you didn't use IB to drag and drop and hook things up, you'd need to do something like this in your code...

superCoolView = [[MyView alloc] initWithFrame:NSMakeFrame(20, 20, 100, 100)];

IB saved you the line of code, plus gave you the ability to visually see the frame of the view, rather than specify it numerically.

Hope this helps!

John

On Dec 15, 2005, at 3:03 PM, Jonathan Faulkenberry wrote:

Hi all. This is a very newbie question concerning basic Cocoa concepts. When I create an outlet in Interface Builder, is it necessary to alloc and init it?

Jonathan



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40positivespinmedia.com

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
  • Follow-Ups:
    • Re: Interface Builder Outlets
      • From: Boyd Collier <email@hidden>
References: 
 >Interface Builder Outlets (From: Jonathan Faulkenberry <email@hidden>)

  • Prev by Date: Re: Interface Builder Outlets
  • Next by Date: Re: CoreData and document loading
  • Previous by thread: Re: Interface Builder Outlets
  • Next by thread: Re: Interface Builder Outlets
  • Index(es):
    • Date
    • Thread