Post

Replies

Boosts

Views

Activity

UICollectionView scrollToItem broken on iOS14
Hi all, since iOS 14, UICollectionView's scrollToItem(at:at:animated:) method is broken under certain circumstances. The setup I'm using UICollectionViewCompositionalLayout to define two sections. The first section scrolls horizontally and also has a section header configured: section.orthogonalScrollingBehavior = .paging let header = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(44)), elementKind: "header", alignment: .top) section.boundarySupplementaryItems = [header] The behavior Depending on different settings for section.orthogonalScrollingBehavior I observe the following: scrollToItem does not work if orthogonalScrollingBehavior is .paging, .groupPaging, .groupPagingCentered ❌ does work if orthogonalScrollingBehavior is .continuous or .continuousGroupLeadingBoundary ✅ does work if I don't add the header to the section ✅ does work if the header's height is .absolute(0) ✅ does work if the header's alignment is .bottom (i.e. if the section's boundarySupplementaryItem is a footer instead of a header) ✅ => As soon as there's a view taking up vertical space before the section scrollToItem does not work (if supplied with an IndexPath for that particular section) Anyone any ideas what might cause this? There's no problem on iOS 13.x.
15
1
12k
Oct ’20