UIView 顶部的 UIButton 与 UITapGestureRecognizer 不起作用
如标题所示,我有一个 UIView
子类,其中添加了 UITapGR
。
在此类的子类中,我在视图顶部放置了一些 UIButton。 UIButton
不会收到任何触摸。当我尝试查看 [[tapGR view] class]
时,它是 UIButton
的父视图。将 setCancelsTouchesInView
调用为 NO 也无济于事。
有什么想法吗?
As in the title, I have an UIView
sublcass with UITapGR
added to it.
In the subclass of this class I'm laying few UIButton
s on top of the view. UIButton
won't receive any touches. When i tried to see [[tapGR view] class]
it was UIButton
's parent view. Calling setCancelsTouchesInView
to NO won't help either.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用以下代码忽略
UIButton
的触摸事件:You can use this code to ignore the touch event for the
UIButton
:如果您希望能够点击某些内容,您可以
If you want to be able to click through something you can