views:

87

answers:

0

Hello,

I'm trying to scroll horizontally through a set of pages, where pages are grouped by two (and can be zoomed both together). So far, my view hierarchy is:

  • One outter UIScrollView that scrolls horizontally.
  • Several inner UIScrollView that contains two pages each, scrolling horizontally too.

The problem I have is that swiping quickly through pages makes the outter UIScrollView skip the inner pages : only the first page of the inner SC are visible, and then the outter UIScrollView skip directly to the next page group. It seems that as long as the outter SC is moving (or decelerating, anyway), the inner SC won't get the swipe events.


I tried several things so far :

  • Use touchesShouldBegin:withEvent:inContentView:: If delaysContentTouch is disabled, this is called during multiple swipes — however touchesShouldCancelInContentView: is only called for the first swipe, and it's probably what would be usefull. So no luck there.
  • Disable scrolling on the outter SC (scrollEnabled = NO) when entering a page group, and re-enable it when the inner SC started to scroll (as then the inner SC will catch all the swiping events): my best try so far. However it's hard to detect which page group we're going to land on after several swipes. Plus it seems that an existing touch is not re-aquired right after scrollEnabled is re-activated, so I miss a few swipes, and the animation is not smooth as it should be (the scroll stops flatly on groups ends, then resumes on next swipe).

(Btw, the problem occurs whether paging is enabled or not: it really lies in the horizontal swipe handling, not in the paging behavior.)

In the end, my question is: how can I prevent the outter UIScrollView from getting all swipe events when it's decelerating, and tell it to pass them to the inners UIScrollViews instead?

Thanks!