上层 UIView 会阻止 UIGestureRecognizer 来降低下层 UIView

发布于 2024-11-25 02:58:22 字数 476 浏览 4 评论 0原文

我有一个 UIView 子类,其中有多个 L 形图像,因此它不会覆盖整个屏幕。在我的屏幕上,我有两个这样的视图,它们彼此层叠,每个视图上都有一个 UIGestureRecognizer。顶视图通常接受手势,但是如果我抓住 L 的“右上角”的透明空间,并且底部视图在下面可见,则底部视图不会接收到手势。事实上,最上面的一个确实如此,但拒​​绝了它,因为我使用了gestureRecognizer:shouldReceiveTouch: 来拒绝该触摸。

gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: 和gestureRecognizerShouldBegin: 都返回YES。

Stacked Views

蓝色视图正常缩放、旋转和平移,但红色只能在最上层和最远层选择右边,没有与蓝色视图重叠的地方

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.

Stacked views

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文