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
Post a Comment