Question

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.

Was it helpful?

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

OTHER TIPS

You can open up an assistant window fr the header file next to the nib, and opt-drag a button to create IBOutlet or IBAction

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top