Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Let's Sekuhara!

macrumors 6502
Original poster
Jun 30, 2008
357
1
日本
I select my custom NSObject in Interface Builder's .xib file and then choose File > Write Class Files but when I look at ClassName.m and ClassName.h none of the Actions of Outlets of my custom NSObject are listed in the code.

What am I doing wrong?
I'm new to programming and very confused.
 
To get actions and outlets from your project into interface builder, you can either use "Read Class Files…" or grab the .h files in Finder and drop them onto the interface builder objects window
 
To get actions and outlets from your project into interface builder, you can either use "Read Class Files…" or grab the .h files in Finder and drop them onto the interface builder objects window

Thank you. I'm trying to go the other way though - from IB to Xcode.
But when I Write Class Files... it seems my Actions and Outlets don't get written to my .m or .h files.
 
If the outlets and actions aren't getting written to the files, add the outlets and actions in Xcode. An outlet is a variable that is part of the class. It looks like this in code:

Code:
IBOutlet id outletName;

id is a pointer to any type. If you know what data type the outlet should be (NSString, NSArrayController, etc.) change id to a pointer of the desired data type.

An action is a class method. It looks like this in code:

Code:
- (IBAction)actionName: (id)sender;

Add the outlets and actions to the .h file. Add the code for the action to the .m file.

On a separate note, if you're learning programming, you may want to start by learning a programming language and writing command-line programs. Command-line programs are easier to write than GUI programs. The following article should help you:

Getting Started with Mac Programming
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.