目标 C:手势问题
我在滚动视图上设置了 UITapGesture,但因此我无法使用滚动视图内的按钮...它读取的只是滚动视图的手势操作。
我该如何解决这个问题?
我有这个代码:
UIGestureRecognizer *tapIt = [[ UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
imgTap = (UITapGestureRecognizer *)tapIt;
imgTap.numberOfTapsRequired = 1;
imgTap.numberOfTouchesRequired = 1;
[scrollView addGestureRecognizer:imgTap];
i set a UITapGesture on my scrollView but because of that i can't use the button inside my scrollView... all it reads is the action of the gesture for the scrollView.
how am i gonna able to fix that?
i have this code:
UIGestureRecognizer *tapIt = [[ UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
imgTap = (UITapGestureRecognizer *)tapIt;
imgTap.numberOfTapsRequired = 1;
imgTap.numberOfTouchesRequired = 1;
[scrollView addGestureRecognizer:imgTap];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试阻止触摸到达手势委托中的按钮:
}
Try to prevent the touch from reaching the button in the gesture delegate:
}
我相信您可以将手势上的 cancelsTouchesInView 属性设置为“否”。还应该有一些方法来忽略视图某些部分中的手势。
I believe you can set cancelsTouchesInView property on your gesture to NO. Also there should be some method to ignore gestures in some parts of a view.