user2848975
user2848975

Reputation: 117

Continous scrolling from scrollview to nested colelctionView

I have collectionView nested inside a scrollView. Both of which scroll Vertically.

In my main scroll View I want to stop it's scrolling when reaching scrollView.contentOffset.y > someValue, and enable scrolling in collectionView

But I want this to happen in one continuous motion without needing to lift finger in between.

Full view

image

Upvotes: 2

Views: 692

Answers (1)

Natarajan
Natarajan

Reputation: 3271

If you want continues scrolling, you should not stop the scrolling of your main scroll view. And you should set the main scrollView.contentOffset.y as constant value once it's reached your max offset(scrollView.contentOffset.y > someValue). And you can increase/decrease the contentOffset.y of your collectionView as per you main scrollview motion.

Example:

if (scrollView.contentOffset.y > 50) {
 scrollView.contentOffset.y = 50.0;
 collectionView.contentOffset.y += 1; //you can do your scroll up/down calculation over here
}

Upvotes: 1

Related Questions