I have an app that implements a photo gallery:
- Each photo in the gallery is implemented as a subclassed UIScrollView.
- The gallery itself is also a UIScrollView with paging enabled.
- A user can swipe left and right in the gallery to change photos. They can also pinch/zoom and translate the photo onscreen while zoomed. If you drag on an edge you can see the next photo, and paging causes it to snap to the adjacent photo.
- The layout of the photos is bit unorthodox and precludes me being able to use one of the pre-existing solutions for this.
My problem is that horizontal movements are sometimes being detected by the gallery, other times by the photo itself. Drags on the photo should move it around, drags on the gallery should change photos. If you're not 'clean' in your drag from left to right, you're not able to scroll, the photo moves a bit, shows the adjacent photo and bounces back.
Is there a tried and true solution to this problem? I'm envisioning measuring the length of the drag (in the photo), and if its over some distance, propagating the event from the photo to the gallery to animate the swipe.