When we declare
-(IBAction) buttonPressed:(id)sender;
what exactly the IBAction is used for???
When we declare
-(IBAction) buttonPressed:(id)sender;
what exactly the IBAction is used for???
This is a duplicate question:
Also,
http://www.cocoadev.com/index.pl?IBAction
You could have found the answer by doing a simple search.
IBAction is used to connect a method to Interface Builder/the XIB file. They allow you to refer to the method in the Interface Builder/XIB file. It also results in void.
IBAction
stands for void
. It's just a constant used from IB to link events to methods
Interface Builder Action. You can see this method in your interface builder and can assign it to some button click event.
It is used as a marker for Interface Builder to identify. It actually doesn't do anything in the code itself. I think it might be defined to be void*
or something like that.
IBAction : The type qualifier IBAction, which is used in place of the void return type, flags the declared method as an action so that Interface Builder is aware of it. For an action method to appear in Interface Builder, you first must declare it in a header file of the class whose instance is to receive the action message
You can refer: Cocoa application