我们如何限制iPhone中的手势?
我的视图中有三种类型的手势(tableview 是我的视图) PinchGesture:重定向到另一个页面 向左滑动:进入下一章 RightSwipe:查看上一章 滚动: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];
}
I have Three type of gestures in my view(tableview is my view)
PinchGesture:redirecting to another page
LeftSwipe:for next chapter
RightSwipe:for previos chapter
Scrolling:tableview scrolling
My requirement is when any one of the gesture acts the other gestures including scrolling of tableview have to be disabled,Is this possible?
my code for gesture is
-(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];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您的手势识别器方法被调用时,您可以尝试。
HTH。
When your gesture recognizer method is called you can try.
HTH.