我的视图中有三种手势(tableview是我的观点) PinchGesture:重定向到另一个页面 LeftSwipe:下一章 RightSwipe:为previos章节 滚动:tableview滚动 我的要求是当任何一个手势动作时,其他手势包括滚动tableview必须被禁用,这可能吗? 我的手势代码是
-(void) handleSwipeGesture:(UISwipeGestureRecognizer*)recognizer {
if(![delegate.selectedChapter isEqualToString:[NSString stringWithFormat:@"%d",[DbHandler mNumberOfChaptersInBook:delegate.selectedBook]]]) {
// if the currentChapter is the last then do nothing
delegate.selectedChapter = [NSString stringWithFormat:@"%d",[delegate.selectedChapter intValue] + 1];
[delegate reloadVerses];
[self resetReadViewToVerse:1];
}
return;
}
-(void) handleSwipeGestureleft:(UISwipeGestureRecognizer*)recognizer {
if(![delegate.selectedChapter isEqualToString:@"1"])
{
delegate.selectedChapter = [NSString stringWithFormat:@"%d",[delegate.selectedChapter intValue] - 1];
[delegate reloadVerses];
[self resetReadViewToVerse:1];
}
return;
}
-(void) longPressDetected:(UISwipeGestureRecognizer*)recognizer {
SearchViewController *aSecondViewController = [[SearchViewController alloc] initWithNibName:@"SearchViewController" bundle:nil];
aSecondViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:aSecondViewController animated:YES];
/*[self.navigationController pushViewController:aSecondViewController animated:YES];*/
[aSecondViewController release];
[UIView commitAnimations];
}
答案 0 :(得分:1)
当您调用手势识别器方法时,您可以尝试。
if (recognizer.state==UIGestureRecognizerStateEnded) {
//Do your thing.
}
HTH。