I looked at the Apple touch touch application and it does not concern my problem. In his application example, when a touch event occurs, he tries to save the view (s) located where the touch event occurs. This makes the logic simple. They are simply looking for views whose frames contain the location of the touch.
This does not work in my scenario. Here is my script.
There is a view containing a bunch of subitems. The idea is to allow the user to sort the cast of one of the subzones in the direction they create. I want the touchesBegan event to find a view whose center is closest to the touch.
Then I want the touchesEnded event touchesEnded move the same view at the speed determined by the start and end events. The speed will not necessarily be the same as the speed of the finger, so I canβt just βattachβ the view to the touch location, as Apple did in the sample application.
I was thinking about marking the view specified in touchesBegan with a touch object and use it to compare with the touch object in the touchesEnded event, but this does not work. The touch object does not match the touchesBegan and touchesEnded .
So what am I missing? How to keep the connection between the moved view and touch?
source share