Amy
Amy

Reputation: 47

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. So that the letters touched can be detected(the continuous touch).

Please Help,

Thanks In Advance.

Upvotes: 1

Views: 145

Answers (2)

Duncan C
Duncan C

Reputation: 131418

As the other poster said, you need to handle the touch events on the superview. You could use touchesBegan/touchesMoved, or you could add a pan gesture recognizer to the superview. Personally, I prefer gesture recognizers. I find them cleaner and easier to use, so I'd go that route.

Upvotes: 1

Brian
Brian

Reputation: 15706

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.

Upvotes: 2

Related Questions