Xcode 3.2 help: "Write Class Files" isn't working

Discussion in 'Mac Programming' started by Let's Sekuhara!, Apr 22, 2010.

  1. Let's Sekuhara! macrumors 6502

    Let's Sekuhara!

    Joined:
    Jun 30, 2008
    Location:
    日本
    #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.
     
  2. Sydde macrumors 68020

    Sydde

    Joined:
    Aug 17, 2009
    #2
    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
     
  3. Let's Sekuhara! thread starter macrumors 6502

    Let's Sekuhara!

    Joined:
    Jun 30, 2008
    Location:
    日本
    #3
    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.
     
  4. szymczyk macrumors regular

    Joined:
    Mar 5, 2006
    #4
    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
     

Share This Page