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.
我正在 CALayer 上进行一些绘图,并希望能够让用户单击绘图的不同部分并触发响应。我尝试研究手势识别器,似乎它们需要绑定到 UIView。知道如何使用 CALayers 获得我想要的行为吗?
您需要一个响应者才能对触摸做出响应。从托管该层的视图(在您的树中的某个点,这必须是真的),您可以使用它-[CALayer hitTest:]来尝试找到将响应您的最深子层。
-[CALayer hitTest:]