开发者

call the function(InApp Purchase)

how can we call the defined function on button action in objective-c on iPhone. for example: we define the function 开发者_C百科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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜