Order that UIScrollViewDelegate methods get called when a user does a sloppy tap.

Please note that the UIScrollView I am using has pagingEnabled set to YES.

To create the sloppy tap gesture, the user makes the most minor drag motion possible with his finger. I call this a "sloppy tap" because about 1 in 10 of my own taps trigger this gesture on my iPad 2. Visually, the scroll view will not appear to move.

  1. scrollViewWillBeginDragging:
  2. scrollViewDidEndDragging:willDecelerate:
Note that scrollViewDidEndDecelerating: will not be called because no scrolling actually happened.

Here is what gets called when a user properly flicks his finger horizontally to scroll to a new page.

  1. scrollViewWillBeginDragging:
  2. scrollViewDidScroll: × ~4
  3. scrollViewDidEndDragging:willDecelerate:
  4. scrollViewDidScroll: × ~24;
  5. scrollViewDidEndDecelerating:
Suppose you want a flag toggled as soon as movement starts, and then you want it toggled again only after movement stops. There isn't one method you can count on for the second flip.

I already toggle the flag in scrollViewWillBeginDragging: and scrollViewDidEndDecelerating:. The solution is to also toggle the flag in scrollViewDidEndDragging:willDecelerate: when decelerate is NO.

I would have figured this out sooner if I had read the documentation more closely.

No comments:

Post a Comment