Search code examples
xcodexcode4interface-builderxcode4.6xcode4.6.3

Where is the actions pane of the class library in Xcode 4?


I'm following along on this tutorial with Xcode 4. The tutorial is for Xcode 3, with Interface Builder, and Xcode has changed since then.

The step I'm on:

diagram of Xcode 3 step
(source: cocoalab.com)

In the palette, in the Action section, click the Add (+) button to add an action (i.e., an action method) to the MFAExampleClass class. Replace the default name provided by Interface Builder by a more meaningful name (for example, you can enter "setTo5:" because we will program this method to display the number 5 in the text field). Add another method, and give it a name (for example "reset:", because we will program it to display the number 0 in the text field). Note that our method names both end with a colon (":"). More about this later.

I've looked through menu items that could be what the "class library" pane, but I can't find it. Does anyone know where it is? Or do I have to accomplish this in a different way then the tutorial describes?

Running Xcode 4.6.3, on Mac OS X 10.8.4.


Solution

  • That button just adds a stub method to your class. You can add it manually:

    @interface MFAExampleClass : NSObject
    ...
    -(IBAction)setTo5:(id)sender;
    @end
    

    and

    @implementation MFAExampleClass
    ...
    -(IBAction)setTo5:(id)sender
    {
        // Action code here
    }
    @end