iPhone UIButton Tap
Posted
by Ivan
on Stack Overflow
See other posts from Stack Overflow
or by Ivan
Published on 2010-04-07T08:22:32Z
Indexed on
2010/04/07
8:23 UTC
Read the original article
Hit count: 416
Hello all,
I am trying to make a button that response to single and double tap. I am trying to do this using myAction method. The problem is that first time when I press the button the method myAction isn't called.
Can somebody tell why this happening and how can I fix that?
-(IBAction)myButton:(id)sender{
UIButton *theButton = (UIButton *)sender;
[theButton addTarget:self action:@selector(myAction:forEvent:) forControlEvents:UIControlEventAllEvents];
}
- (void)myAction:(id)sender forEvent:(UIEvent *)event {
NSLog(@"Touch events goes here");
}
Thank you,
I. Vasilev
© Stack Overflow or respective owner