how can we call the defined function on button action in objective-c on iPhone. for example: we define the function as follow -(void)abc { // }
now how can i call this function on the button action
how can we call the defined function on button action in objective-c on iPhone. for example: we define the function as follow -(void)abc { // }
now how can i call this function on the button action
What does "on button action" mean? You need to read a basic tutorial on using Interface Builder/Xcode. Apple's "Getting Started" documents may not be simple enough.
In short, you need to drag from the button to your controller object, and select the action. For this to be enabled, you need to declare it as -(IBAction)abc;
You have to create an -(IBAction)abc:(id)sender;
IBAction in your .h file, and a respective method in your implementation (.m) file. In Interface Builder, you then have to right click on the button, and from the circle next to Tap Up Inside drag over to your File's Owner box. Then let go over abc and you're golden.
Implement the code you want to run in your abc() method.