Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有几个视图堆叠在另一个之上(彼此的所有子视图),其中每个视图都附加了一个 UITapGestureRecognizer。 如何确保最高可见视图接收到手势而不是最远的祖先?
点击手势仅对当前视图有效。进一步了解您当前视图的框架(-控制器)。您可以在孔屏幕上创建一个空白视图,然后将当前视图放在那里200x200 px。(本质上它都在同一个视图中) 现在所有手势都应该响应您最顶层的视图控制器。坏事是:你不能再访问下面的视图了。
200x200 px