Sunday, 23 December 2018

Transfer interaction of UIScrollView to another UIScrollView mid-scroll

I have an interface with the following structure, with names for important elements in brackets:

- UIViewController
      - UIScrollView (ScrollViewA)
           - UIViewController (ProfileOverviewViewController)
           - UIViewController (ProfileDetailViewController)
               - UICollectionView (ScrollViewB)

So essentially there is a vertical scroll view (ScrollViewB) inside another vertical scroll view (ScrollViewA). ProfileOverviewViewController and ProfileDetailViewController are both the size of the device screen, so ScrollViewB is only visible once ScrollViewA is scrolled to the bottom.

Pagination is enabled on ScrollViewA, so snaps to either ProfileOverviewViewController taking the whole screen view or ProfileDetailViewController taking the whole screen view.

Hopefully this graphic makes the layout a bit more clear: Layout

My question is:

  • If the user scrolls to the bottom of ScrollViewA so that ProfileDetailViewController and ScrollViewB is visible.
  • The user scrolls down a bit on ScrollViewB then releases.
  • Then the user scrolls up on ScrollViewB.
  • Whilst still holding down the finger, when the user reaches the top of the content in ScrollViewB, ScrollViewB should stop scrolling and the ScrollViewA should start scrolling up towards ProfileOverviewViewController, all within the same finger gesture from the user.

Instead of at the moment where ScrollViewB will simply extend to a negative y content offset since bounces property is true.

How can I transfer the scrolling of ScrollViewB to ScrollViewA when it reaches the top?

Thanks in advance



from Transfer interaction of UIScrollView to another UIScrollView mid-scroll

No comments:

Post a Comment