屏幕底部的 UIView Touch 事件未触发
我遇到了一个奇怪的问题。我创建了一个发生在屏幕底部的 UIView (0,431,320,49) 然后我想处理触摸事件。
当我触摸 UIView 的上侧时,它就起作用了。但是当我触摸底部(我的意思是,相对位置超过 20px)时,touchBegan 事件不会被触发。
听起来我的网络状态栏有问题,它会以某种方式改变我的代码的行为。
有人有什么想法吗?
问候,
马蒂厄
I am encountering a strange problem. I created a UIView that takes place at the bottom of the screen
(0,431,320,49) and then I want to deal with touch events.
When I touch the upper side of the UIView, it works. But when I touch the bottom side (I mean, more than 20px in relative position), the touchBegan event is not fired.
It sounds like I have a problem with the network status bar that would change in some way the behavior of my code.
Does someone have any idea?
Regards,
Mathieu
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您的 UIView 上方有一个透明视图,它接收触摸事件,并且不会将这些事件传递给其下方的视图。
或者,我遇到的另一个情况是,我为我的视图分配了错误的框架。上面的视图看起来不错,并且在未包含在错误帧中的某些点上无法接收触摸事件。
例如,我将帧(10,10,300,280)分配给我的viewController的视图,并向该视图添加一个帧为(0,0,320,480)的子视图。所以子视图看起来不错,但是无法接收到点(0, 0)处的触摸事件。
Maybe there is a transparent view above your UIView, it receives the touch event, and it does not pass those events to the view below it.
Or, another case I encountered, I assign the wrong frame to my view. The above views have a good looking, and touch event cannot be received at some point that is not contained in the wrong frame.
For example, I assigned frame (10,10,300,280) to my viewController's view, and add a subview with frame (0, 0, 320, 480) to the view. So the subview looks well, but touch event at point (0, 0) cannot be received.