I'm trying to create custom vertical UIScrollView which could handle multiple pages with different page heights.
Assumptions:
- page height is equal or greater than screen height
- if page is taller than screen height, it scrolls as usual UIScrollView – with bouncing on top and bottom
- if user ends up scrolling and "page break" is in the middle of screen
- if there is no velocity - page snaps to closest
- if there is velocity - page changes to one in direction of swipe
I've tried many approaches to achieve this, but I've stumbled upon many UIScrollView quirks, which make it hard.
Problems:
- UIPanGestureRecognizer has unreliable method for getting velocity (velocityInView:)
- scrollViewWillEndDragging:withVelocity:targetContentOffset: method gives me headache, because it arbitrarily can destroy my attempts to animate setting content offset
- I don't know how to achieve bounce in one of the middle pages, I'm afraid i would have to rewrite whole scrolling handling
- when I try to override setting content offset when UIScrollView is decelerating, what I get is
- my content offset is set
- deceleration continues beyond content offset I set
Bonus
I have also tried putting UIScrollView inside UIScrollView as a page, but this approach was also pain in the neck. For example when I was at the bottom of inside scroll, then i scrolled down a bit, put my finger away and quickly grabbed again and scrolled upwards, the outer scroll received touch, which messed up inside scroll presentation.
Does somebody have any idea how to do this? Any tips will be helpful as I'm completely stuck...