3

I have a CollectionView that is inside a contentView within a scrollview.

If I reach the second row of the collectionview that is hidden, the scrollview won't seem to scroll up to show the second row. It could be the focus that's doing this, just not sure how I can handle this.

Thanks!

5
  • Make sure the constraints on your collection View make the scrollViews contentView larger then the ScrollView. ScrollViews won't scroll unless this is done. Commented Nov 16, 2015 at 22:38
  • @MatthewLawrenceBailey contentview is larger than scrollviews with the right content. I can scroll on the view if I allow scrolling through the remote control but if I were to just focus to the next row of items in the collectionview - the scrollview doesn't scroll automatically Commented Nov 17, 2015 at 16:13
  • Did you disable "scrolling enabled" on the collectionview? Commented Nov 19, 2015 at 8:51
  • @JeroenBakker I didn't disable it - it is enabled Commented Nov 19, 2015 at 15:34
  • A really stupid annoying mistake is when you FORGET TO SELECT "HORIZONTAL" on the collection view !!!!!!!!! Commented Mar 20, 2021 at 17:24

2 Answers 2

1

I fixed the same issue disabling Scrolling Enabled option on particular UICollectionView.

Now when UICollectionViewCell is focused it is scrolling properly.

I Know this is not ideal solution but it seams to me that it's kind of bug.

Scrolling Disabled

Hope this helps. I'm still looking for solution without limitations.

Sign up to request clarification or add additional context in comments.

Comments

1

As an improvement to the previous answer by tomaspavlic, if you have a UICollectionView that scrolls horizontally inside of an existing UICollectionViewCell (of a UICollectionView that scrolls vertically), you can implement the following as a part of the parent cell:

- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
{
    self.collectionView.scrollEnabled = [context.nextFocusedView isDescendantOfView:self];
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.