上层 UIView 会阻止 UIGestureRecognizer 来降低下层 UIView
我有一个 UIView 子类,其中有多个 L 形图像,因此它不会覆盖整个屏幕。在我的屏幕上,我有两个这样的视图,它们彼此层叠,每个视图上都有一个 UIGestureRecognizer。顶视图通常接受手势,但是如果我抓住 L 的“右上角”的透明空间,并且底部视图在下面可见,则底部视图不会接收到手势。事实上,最上面的一个确实如此,但拒绝了它,因为我使用了gestureRecognizer:shouldReceiveTouch: 来拒绝该触摸。
gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: 和gestureRecognizerShouldBegin: 都返回YES。
蓝色视图正常缩放、旋转和平移,但红色只能在最上层和最远层选择右边,没有与蓝色视图重叠的地方
I have a UIView subclass that has several images in an L shape, and so it doesn't cover the entire screen. On my screen I have two of these views layered on top of each other, and each has a UIGestureRecognizer on them. The top view accepts gestures normally, however if I grab in the transparent space in the "top right" of the L, with the bottom one visible underneath, the bottom one does not recieve the gesture. Indeed the top one does, but rejects it as I've used gestureRecognizer:shouldReceiveTouch: to reject that touch.
Both gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: and gestureRecognizerShouldBegin: both return YES.
The blue view scales, rotates and pans normally, but the red on can only be selected in the far top and far right, where there is no overlay with the blue view
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论