Questions tagged [uicollectionviewcompositionallayout]
206 questions
4
votes
0 answers
UICollectionViewCompositionalLayout + UICollectionViewDiffableDataSource: is there a way to change a decoration view depending on section data?
I have a UICollectionView that uses UICollectionViewCompositionalLayout and UICollectionViewDiffableDataSource and it works fine.
Cells are provided by a cellProvider defined in the initialiser of the datasource. The provider returns cells with…

Gerd Castan
- 6,275
- 3
- 44
- 89
3
votes
1 answer
Cannot disable Section bouncing in CollectionView - Compositional Layout
I have a collectionView with compositional layout which scrolls vertically, with each section inside it scrolling horizontally.
I would need to disable bouncing on horizontal scroll, which does not seem to be possible (or maybe I'm doing something…
3
votes
0 answers
iOS 16 collectionView layoutAttributesForItem return the wrong size with estimated height compositional layout
I ran into an ios 16 problem when layoutAttributesForItem returns a very small cell size if it is far beyond the scope and visibility and has not yet been seen.
I'm using compositional layout with estimated(1) and it feels like its real size is not…

Nikolay Pivnik
- 31
- 2
3
votes
0 answers
UICollectionView compositional layout: custom item size for remaining space?
I'm reading Apple's documentation on compositional layout, for following code example:
func createBasicListLayout() -> UICollectionViewLayout {
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), …

Heuristic
- 5,087
- 9
- 54
- 94
3
votes
0 answers
UICollectionViewCompositionLayout with nested groups
I am trying to build a view that list items and each item has subitems which users can scroll through horizontally (orthogonal scroll).
I know this can be done using a tableview and a horizontal collectionView in each cell, however, I am trying to…

EK_AllDay
- 1,095
- 2
- 15
- 35
3
votes
0 answers
UICollectionViewCompositionalLayout Equal item height
I’ve faced the issue of setting the two cells in horizontal group equal height (= height of largest cell in the row). Now it looks almost like intended
But I need the left (smaller) cell’s height == right (bigger) cells height.
Label has no…

dimazava
- 370
- 1
- 14
3
votes
1 answer
Programmatically Scroll at specific item or offset, with UIKit Compositional Layout collectionView?
I have an iOS 14 collectionView, configured with compositional layout.
You can scroll vertically through the collectionView, and you can scroll horizontally within the sections.
I would like to know if there is a way to scroll programmatically,…

darksider
- 1,030
- 2
- 14
- 20
3
votes
0 answers
Place NSCollectionLayoutBoundarySupplementaryItem on top of cells
I'm having trouble with adding a footer in UICollectionViewCompositionalLayout on top of the cells. Specifically I want to have an interactive control in my footer (in my case a UIPageControl). This is an example layout,
func generateLayout() ->…

Simon
- 55
- 3
3
votes
2 answers
collectionview global header does not push cells down and stays on top instead
I have a collection view header (blue) and cells (red). I want to be able to show/hide header programmatically, however when I show the header programatically it appears on top of the cell (or makes scrollview go down a bit). I would like the header…

Markon
- 741
- 8
- 23
3
votes
0 answers
Dynamic-Sized Header in a CollectionView with Compositional Layout
I have a collection view powered by compositional layout + diffable data source. It uses three supplementary boundary items: a header, footer, and "leading-header".
App Layout Example
The problem is: fractional size for leading headers is based on…

theogood
- 85
- 1
- 1
- 7
3
votes
1 answer
How to create collection view like image with UICollectionViewCompositionalLayout
For a couple of days I can't figure out how to make a collection view like in the screenshot using UICollectionViewCompositionalLayout. Can anyone help ?
Image!!!!

Factum Game
- 33
- 3
3
votes
1 answer
How do you support swiping to delete a row in a UICollectionView list with compositional layout?
Previously with table views this was done in the UITableViewDataSource delegate callback tableView(_:commit:forRowAt:). Is there equivalent functionality in the APIs associated with the new collection views, or a recommended way of implementing it?

Curiosity
- 544
- 1
- 15
- 29
3
votes
5 answers
Trying to hook up Compositional Layout CollectionView with PageControl. visibleItemsInvalidationHandler is not calling
I want to implement paging on a welcome screen in iOS app (iOS 13, swift 5.2, xcode 11.5).
For this purpose, I use a UICollectionView and UIPageControl. Now I need to bind pageControl to Collection view.
At first, I tried to use UIScrollViewDelegate…

Oleg Titov
- 51
- 1
- 5
3
votes
0 answers
Vertical scrolling (or visibleItemsInvalidationHandler) resets the inner offset of the orthogonal section with groupPagingCentered
I did UICollectionViewCompositionalLayout with orthogonal section with groupPagingCentered as follow:
func neighborsRealitiesSection() -> NSCollectionLayoutSection {
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),…

Mikhail Zimin
- 31
- 3
3
votes
1 answer
UICollectionView Cell Expansion Animation Problem
I'm having an issue where my UICollectionView using UICollectionViewCompositionalLayout + Diffable Data source is not allowing me to animate vertical cell expansion smoothly. I have a single column of full-width cells similar to a UITableView, and…

223x95
- 43
- 1
- 5