2

I'm following a slightly outdated the guide from cocoalab.com (Become An Xcoder) to learn the basics of cocoa, but I'm stuck on one of the instructions.

On page 45 (section 08:9) in the section titled "Creating connections", it tells me to select the instance of my new class, and from the identity inspector, to add two actions and an outlet.

I'm using Xcode 4.3.1 which is obviously a bit different to the version that this tutorial was written for, but I can't figure out how to do the equivalent in this newer version.

Can anyone please help by giving me step by step instructions of how to add these to my object.

Grezzo
  • 2,220
  • 2
  • 22
  • 39

2 Answers2

8

Open the Assistant Editor (red rectangle in the screenshot). Then, from Interface Builder, press the ctrl key and drag the mouse from the button (or an other control in you view) to the .h file.

enter image description here

You will be prompted to choose the type of the connection to create as in the screenshot below:

enter image description here

sch
  • 27,436
  • 3
  • 68
  • 83
  • Learning xcode has gone on the back burner for a while, so I'm not able to confirm this myself, but this one did get two upvotes compared to no upvotes for the other two answers, so I'm guessing it must be correct, and accepting it. – Grezzo May 24 '12 at 13:56
  • 2
    When I do this, there's no option for Action. There is only options for Outlet and Outlet Connections. What am I doing wrong? – Cin316 Mar 31 '13 at 13:28
  • this doesn't answer the question. In his environment he doesn't see "Action". I didn't either but fixed by quitting and restarting Xcode. – nktokyo Apr 28 '13 at 14:17
  • @sch is this an only way to create outlet and action? I have read many tutorials and they just point this way. Thanks :) – hqt Jul 30 '14 at 09:55
0

I would suggest to follow the nice and easy tutorial on developer.apple.com - search for "Your First iOS App".

This explains how to add an outlet, and an action - all using the latest version of XCode. Won't take you long to do, but will get you up to speed with all the features you need.

Hope this helps :)

Stretch
  • 3,669
  • 2
  • 28
  • 40
  • OK I have just realised that you might not want iOS.. however I think my answer is still valid for Mac, and will be helpful for iOS programmers with the same outlet/action issue who stumble on this question. – Stretch Mar 19 '12 at 22:57