简体   繁体   English

在多个图像视图中滑动手指

[英]Sliding finger across multiple image views

I have dynamically created a grid of 8x8 image views over which letters are displayed and assigned the tag to each.I can detect the touch on each image view through Tap Gestures but what I want now is : if the user slide its finger across the letters, i would be able to get the each image view tag. 我动态创建了一个8x8图像视图的网格,其中显示了字母并为每个图像分配了标记。我可以通过Tap手势检测每个图像视图上的触摸,但我现在想要的是:如果用户将手指滑过字母,我将能够获得每个图像视图标记。 So that the letters touched can be detected(the continuous touch). 这样可以检测到触摸的字母(连续触摸)。

Please Help, 请帮忙,

Thanks In Advance. 提前致谢。

Disable user interaction on the individual image views and handle touches on the superview containing them instead. 禁用单个图像视图上的用户交互,并处理包含它们的超级视图上的触摸。 Then you can figure out which image the user's finger is over in touchesMoved. 然后你可以在touchesMoved中找出用户的手指在哪个图像上。

As the other poster said, you need to handle the touch events on the superview. 正如另一张海报所说,你需要处理superview上的触摸事件。 You could use touchesBegan/touchesMoved, or you could add a pan gesture recognizer to the superview. 您可以使用touchesBegan / touchesMoved,或者您可以向超级视图添加平移手势识别器。 Personally, I prefer gesture recognizers. 就个人而言,我更喜欢手势识别器。 I find them cleaner and easier to use, so I'd go that route. 我发现它们更清洁,更容易使用,所以我会走那条路。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM