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.
我有多个 UIImageViews 启用了用户交互。我正在实现touchesBegan,有没有办法猜测触摸了哪个图像视图,而不是根据所有图像视图制作一个矩形并检查它们中是否存在接触点?
我还为每个图像视图分配了不同的标签。
在您的 touchesBegan:withEvent: 方法中,您可以检查 UITouch 对象的“视图”属性。来自文档:“属性的值是最初发生触摸的视图对象”。