Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TVOS - UICollectionView inside scrollview - scrollview doesn't scroll

Tags:

swift

tvos

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!

like image 535
John D Avatar asked Nov 26 '25 21:11

John D


2 Answers

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.

like image 171
Tomas P. Avatar answered Nov 29 '25 16:11

Tomas P.


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];
}
like image 28
Dimitri Bouniol Avatar answered Nov 29 '25 15:11

Dimitri Bouniol



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!