iphone - iOS overlapped views and UIGestureRecognizer -
i have view uibutton within this:
the button bound ibaction:
-(ibaction)deletebuttonpressed :(id)sender{ nslog(@"deletebuttonpressed"); } i have view shows collection of lastly view:
in controller of view, @ point have this:
uitapgesturerecognizer *tapgesture = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(tapaction:)]; tapgesture.numberoftapsrequired = 1; tapgesture.numberoftouchesrequired = 1; [preview addgesturerecognizer:tapgesture]; and this:
- (void)tapaction:(uigesturerecognizer *)gesturerecognizer{ editorviewcontroller *vc = [self.storyboard instantiateviewcontrollerwithidentifier:@"editorviewcontroller"]; vc.narration = preview.narration; self.navigationitem.backbarbuttonitem.style = uibarbuttonitemstyleplain; self.navigationitem.backbarbuttonitem.title = @"done"; vc.navigationitem.backbarbuttonitem.style = uibarbuttonitemstyleplain; vc.navigationitem.backbarbuttonitem.title = @"done"; [self.navigationcontroller pushviewcontroller:vc animated:yes]; } so, when touch in preview, load view. problems come when tap button. in case, function -(ibaction)deletebuttonpressed: (id)sender doesn't executed tapaction does. also, button alter while pressed. tried don't add together gesturerecognizer , -(ibaction)deletebuttonpressed :(id)sender executed.
what doing wrong? how can accomplish when tap on button, view underneath doesn't capture gesture?
you need implement shouldreceivetouch method (which part of uigesturerecognizerdelegate protocol).
more info problem here:
gesture recognizer , button actions
iphone ios ipad uigesturerecognizer
No comments:
Post a Comment