1
votes

Some context for why I ask this:

I have an UIScrollView on which I draw directly using UIBezierPaths. When there are many/long paths and the user starts scrolling the scrollview it would become impossible to draw all the paths in drawRect.

So I made a work around where I draw all the paths onto an uiimageview (without using retina and with a lower flatness) when scrollViewWillBeginDragging: fires. I add this imageview to my scrollview and temporarily stop drawing paths in drawRect.

I then remove this imageview from the scrollview and set it to nil when either of these fire: scrollViewDidEndDragging:willDecelerate: (only when decelerate == NO) scrollViewDidEndDecelerating:

This all works great. Drawing is fast, scrolling is fast.

But there is one problem when:

  1. User starts scrolling and releases the screen with speed so the scrollview starts decelerating.
  2. Then the users taps the scrollview while it's still decelerating, causing the scrollview to stop immediately.

Neither of the scrollViewDidEnd: functions is called at this moment. So my imageview isn't removed and stays in memory (and worse the non-retina, low flatness curves are still visible).

My question:

How do I know when the user taps the UIScrollView while it is decelerating?

1
This always happens, search for hours to no avail. Then post the question and 3min later find the answer yourself: -(void)scrollViewWillBeginDragging is called again when the user taps while deceleratingpposthoorn
You should post that as an answer to your question and mark it. Will be helpful to others with a similar problem and give you more opportunity to gain rep.Stunner

1 Answers

0
votes

I found the answer myself: -(void)scrollViewWillBeginDragging is called again when the user taps the scrollview during deceleration.