What is -(IBAction)

Discussion in 'iOS Development' started by thund3r, Aug 15, 2010.

  1. thund3r

    thund3r Member

    Joined:
    Feb 8, 2009
    Messages:
    100
    Likes Received:
    0
    Device:
    iPad
    The title says it all.
  2. macsplash

    macsplash New Member

    Joined:
    Aug 15, 2010
    Messages:
    49
    Likes Received:
    0
    Interface Builder Action used to fro example play a sound when click on a button or change view or play a movie.
  3. Pelaez-1

    Pelaez-1 New Member

    Joined:
    May 5, 2008
    Messages:
    822
    Likes Received:
    0
    Device:
    iPhone
    Nononono, wrong. (Not wrong technically, but you should give a more complete answer)


    IBAction is a way to link a method to Interface Builder.
    It's a typedef for void, meaning that that method should not return any values.
    (It's pretty much the same as if you did -(void)blahblah;, just that Interface Builder will recognize it and you'll be able to assign it to actions)
  4. Axis

    Axis Super Moderator Staff Member

    Joined:
    Dec 2, 2007
    Messages:
    6,288
    Likes Received:
    133
    Device:
    iPhone 4S (White)
    Correct. @ OP: If you're curious, 'IBOutlet' is a macro that "expands" to nothing (Interface Builder uses it to recognize outlets pre-compile time).
    [objc]
    #ifndef IBOutlet
    #define IBOutlet
    #endif
    [/objc]
  5. macsplash

    macsplash New Member

    Joined:
    Aug 15, 2010
    Messages:
    49
    Likes Received:
    0
    Yes that is the complete version but I was just making it easy for the OP to understand.
  6. Pelaez-1

    Pelaez-1 New Member

    Joined:
    May 5, 2008
    Messages:
    822
    Likes Received:
    0
    Device:
    iPhone
    Your answer was way too vague.

Share This Page