don't see class action in inspector window

Discussion in 'iOS Programming' started by sundark, Jun 20, 2010.

  1. sundark macrumors newbie

    Jun 20, 2010
    i was trying to create outlets and actions in inspector window. The book says
    1. select File Owner icon on the nib file
    2. In the Inspector Window, under the Class Actions sections, click the plus (+) button,to add an action named btnClicked.

    I can't seem to find the class actions section at all i the Inspector window - what am I doing wrong ?
  2. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    Which book (end edition)?

    Which version of Xcode/IB?
  3. PatrickCocoa macrumors 6502a

    Dec 2, 2008
    You have to have specified the methods (if that's what you mean by class actions) in Xcode before you go to Interface Builder.

    To do so, in your interface/header file (.h), enter:

    -(IBAction) btnClicked;
    In your implementation file (.m), enter:

    -(IBAction) btnClicked
      NSLog(@"It worked!");
    Then save the above in Xcode. Then go to IB and the btnClicked method will show up when you click the plus (+) button, to add an action named btnClicked.

    If that's not your question, or it still doesn't work, then throw away the book you're using, get a new book, and work through it following the instructions exactly.
  4. sundark thread starter macrumors newbie

    Jun 20, 2010
    Usually I define the outlets and actions in the view controller class and link them in the interface builder.
    However, the book (Beginning iPhone SDK Programming by Wei Meng Lee), suggested that you can alternatively create outlets and actions in the Interfacebuilder and then generate the corresponding code in the classes by simply clicking the Generate Code menu option. It's the reverse of what we generally do.
    I just was curious whether there was any setup issue with the xCode.

  5. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    From the Release Notes for Interface Builder 3.2:
  6. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    Most developers these days update the text in their header files in the Xcode editor and make the connections between objects in IB. That's how I recommend that you work. However some developers in olden days used to add outlets and actions in IB and have them sent back to Xcode. I'm pretty sure you can still do that but I haven't tried it in a few years.

    They moved the location of the viewer for outlets and actions in a recent version of IB so what you're seeing in IB probably has changed since the book was published. The outlets and actions are in the Library inspector. Click the Classes tab, choose the class that you want to view, and in the bottom pane choose Outlets or Actions from the popup menu. There's now a + button where you can add new outlets and actions. At the bottom of the window there's a gear popup menu that has an item to write class files. I haven't monkeyed around with any of that but the UI seems to still be there.

Share This Page