RE: Interface Builder & Wiring Objects
RE: Interface Builder & Wiring Objects
- Subject: RE: Interface Builder & Wiring Objects
- From: Etienne Guérard <email@hidden>
- Date: Mon, 17 Nov 2008 14:10:38 -0500
- Thread-topic: Interface Builder & Wiring Objects
As you pointed out, you have two kinds of relationship in IB: outlets and actions.
>From a single object, you designate either an outlet object or a target object.
For the target case, you have to specify the associated action selector.
Usually though, you don't draw both kinds of connection from the same kind of objects.
Controls send actions to target objects such as the First Responder.
Controllers use outlets to reference other UI objects in source code.
So you always CTRL-drag connections from your source object.
With the introduction of Cocoa Bindings, you now have a third kind of relationship in IB: bindings.
You don't have to CTRL-drag anything when using bindings since the connections are based on key path.
However, you can mix both use of connections, such as connecting the File Owner of your nib to the content object outlet of an ObjectController instance.
EG
-----Original Message-----
I am trying to learn Cocoa and am having difficulty remembering which
direction to CTRL-drag controls to wire up the controls in Interface
Builder. For example, dragging from my button to my App Controller
(NSObject) or vice versa. Does anyone have a way to explain this that
might make it stick?
It seems to me that a button should make a call to my App Controller
when the click event is fired; therefore I should CTRL-drag FROM the
button TO the NSObject. This would allow me to select the appropriate
Received Action (ie, "doSomething", etc."). However, if I need to do
something with a text box (read from it) and a table view (insert an
item), I should go the other way... since I'm going to fetch from the
text field and then insert into the NSArray that is feeding the text
view.
Sorry for such a noob question. Thank you, in advance, for your
patience and assistance.
-- Greg
------------------------------------------------------------
This message and any attachments (the "message") are confidential and intended solely for the addressee(s). Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration. Neither DxO Labs nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified.
Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout message electronique est susceptible d'alteration. DxO Labs et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, modifie ou falsifie.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden