views:

32

answers:

2

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

A: 

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;

Paul Lynch
thanks lots for help
A: 

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.

SeniorShizzle
Did any of these answer your question? They are all pretty thorough answers so if you wouldn't mind, a lot of us would be thankful if you would take the time to select the most helpful and accept it. This goes for all of your other questions, too.
SeniorShizzle