I have multiple images on screen that are draggable via touch, and currently I am using touchesBegin:
, touchesMoved:
and touchesEnded:
to make these images movable. My goal is to allow the user to be able to select one image on the screen via dragging, but noticed that if multiple fingers are used, multiple items could be dragged, and thus selected. I was wondering if there is a way only allow one image to be dragged despite multiple fingers touch the screen.
As an alternative, I could certainly put up a condition and an alertview that informs the user only one image could be dragged when it detects multiple drag, but I was wondering if there is a more elegant solution in which I could impose some control on what the user could and could not do right from the touch level.
Thanks!
Instead you can add the UIPanGestureRecognizer
to your main view and set the property maximumNumberOfTouches
to 1. and handle the dragging of imageViews inside the selector method of UIPanGestureRecognizer.