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:
- User starts scrolling and releases the screen with speed so the scrollview starts decelerating.
- 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?