Action methods vs Normal methods

So what is the difference between an action method and a regular method? Nothing. An action method is really just the same as any other method. The only special thing is the (IBAction) specifier. This allows Interface Builder to see the method so you can hook it up to your buttons, sliders, and so on.

Other methods, such as viewDidLoad, do not have the IBAction specifier. This is a good thing because all kinds of mayhem would occur if you hooked them up to your buttons.

This is the simple form of an action method:

1
- (IBAction)doSomething;

You can also ask for a reference to the object that triggered this action:

1
- (IBAction)buttonTapped:(UIButton *)button;

But this method cannot be used as an action from Interface Builder:

1
- (void)someOtherMethod;
0%