如何在ios的uipageviewcontroller上单击一下禁用页面卷曲
我在根视图控制器的底部有图像的缩略图视图。它在页面中间工作正常,但是当我单击缩略图视图的左角或右角时,它会卷曲页面视图而不是缩略图图像选择。
我尝试过以下功能,但该功能在我的情况下不起作用。
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
NSLog(@"overiding page curl feature");
//Touch gestures below top bar should not make the page turn.
//EDITED Check for only Tap here instead.
if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) {
CGPoint touchPoint = [touch locationInView:self.view];
if (touchPoint.y > 40) {
return NO;
}
else if (touchPoint.x > 50 && touchPoint.x < 430) {
//Let the buttons in the middle of the top bar receive the touch
return NO;
}
}
else{NSLog(@"in else case");}
return YES;
}
I have thumbnail view of images on the bottom of root view controller. It works fine in the middle of the page but when i single tap on the left or right corner of the thumbnail view it curls the page view instead of thumbnail image selection.
I have tried following function but this function does not work in my case.
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
NSLog(@"overiding page curl feature");
//Touch gestures below top bar should not make the page turn.
//EDITED Check for only Tap here instead.
if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) {
CGPoint touchPoint = [touch locationInView:self.view];
if (touchPoint.y > 40) {
return NO;
}
else if (touchPoint.x > 50 && touchPoint.x < 430) {
//Let the buttons in the middle of the top bar receive the touch
return NO;
}
}
else{NSLog(@"in else case");}
return YES;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有点晚了,但我也遇到了这个问题,并用 this 解决了它。希望这可以帮助您或其他像我一样跌跌撞撞的人。还有其他一些很好的答案和讨论。
Bit late but I had this problem too and solved it with this. Hope that helps you or someone else stumbling around like I was. Some other good answers and discussion there too.