Re: Interface Builder Outlets
Re: Interface Builder Outlets
- Subject: Re: Interface Builder Outlets
- From: Bergmann Manfred <email@hidden>
- Date: Fri, 16 Dec 2005 17:21:05 +1100
Hi Boyd.
IMHO are Outlets not directly pointers. In fact objects are nothing
more than some bytes of memory. And to address an object you have a
variable (not the Outlet) which is the pointer. The term Outlet is
just a keyword to let Interface Builder know that it has do deal with
the object (all other objects declared in the header file are ignored
by it).
But due to the fact that IB can only deal with objects you could say
that Outlets are pointers, although it's not completely right. ;)
best regards,
Manfred
Am 16.12.2005 um 16:11 schrieb Boyd Collier:
I, too, am a newbie, at least with respect to cocoa and OOP, and I
had been struggling for some time with a problem having to do with
making connections between objects. However, I've had quite a bit
of experience programming in C, and I recently solved my problem by
drawing on that (rather rusty) background. The relevance to
Jonathan's question and John's comment is this (and please tell me
if I'm off base): Outlets are pointers; that is, they are addresses
of other stuff, e.g. objects. Thus, to say, as John did, that one
can think of an outlet as being an object is somewhat misleading;
it's really a pointer to an object. This may become important in
connecting up an object that is "created" by using a nib to another
object that is perhaps created programmatically. I'll send a
longer explanation to Jonathan separately, but if anyone else is
interested in taking pot-shots at what I've said, let me know.
Boyd
On Dec 15, 2005, at 2:19 PM, John Pannell wrote:
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:
40sunstroke.sdsu.edu
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:
40software-by-mabe.com
This email sent to email@hidden
--
software by MABE
http://www.software-by-mabe.com
_______________________________________________
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