iphone - is Gesture Recognization working on buttons or not? -


in app, wrote these lines of code :

- (void)viewdidload { [super viewdidload];  uitapgesturerecognizer *tapper = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(tapped:)];  [mybutton1 addgesturerecognizer:tapper]; [mybutton2 addgesturerecognizer:tapper]; [mybutton3 addgesturerecognizer:tapper];      [tapper release]; }  -(void)tapped:(uigesturerecognizer *)sender{ nslog(@"i'am in tapped");   } 

but nothing happened. why ? , if need button's currenttitle inside tapped, can ?

thanks

you're missing recognizer delegate. implement that. should add uigesturerecognizerdelegate protocol header file , make recognizer.delegate = self.

re: getting title - can title. in tap event handler can extract information sender object. i'll post code later...


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -