Cocoa – how to identify Button click in Cocoa /Objective-C

cocoa-touch

I have a button in my program to start a new game.I didn't
use IB,done it manually.Now the problem is that how will i identify
that the button is pressed .Is there any built-in method like
'ButtonClick' or something??I have used :-

-(void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event

In this function i used

CGPoint pt = [[touches anyObject] locationInView:self];
to find touch position.And then used this to determine whether it
is inside the button.If then i triggerd a action.But my program
doesn't work.So Can anyone help me????

Best Answer

You have to implement it in the button and pass it to the responder. Check out this link

http://www.iphonedevforums.com/forum/sdk-coding-help/1101-detect-position-x-when-i-click-button.html