Questions tagged [uicollectionviewflowlayout]
209 questions
2
votes
2 answers
Self sizing UICollectionView with FlowLayout and variable number of cells
Please note that this is NOT a question about self sizing UICollectionViewCell.
Is it possible to create self sizing UICollectionView (with UICollectionViewFlowLayout) size of which depends on cells inside it?
I have a collection view with variable…

iur
- 2,056
- 2
- 13
- 30
2
votes
2 answers
How to show a collectionView like facebook upload image using swift 4?
Hello i want to show the collectionView exactly as the above image. I know that it responsible for UICollectionViewFlowLayout, but unable to do it. Help is much appreciated. Here is my code
func collectionView(_ collectionView: UICollectionView,…

Gorib Developer
- 587
- 2
- 13
- 27
2
votes
1 answer
UICollectionView custom layout cell-type-dependent attribute
My collection view has a dynamic layout and multiple cell/header types, and I would like to apply background color to only certain types of headers. The way I tried, unsuccessfully, to determine the IndexPath of those headers during run time…

Jack Guo
- 3,959
- 8
- 39
- 60
2
votes
5 answers
How to use collectionview flow layout to get correct view?
I am using this code to get correct type but not getting the view what i want can any one tell me where am i wrong
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
screenSize = UIScreen.main.bounds
…

user9483522
- 304
- 5
- 20
2
votes
1 answer
UICollectionViewLayout: add DecorationView only to specific cells
I've developed a custom CollectionViewLayout which uses DecorationView to show shadows behind the cells.
However, I'd like to add this decoration only to some cells. The UICollectionView is vertical, but it may contain an embedded horizontal…

Richard Topchii
- 7,075
- 8
- 48
- 115
2
votes
1 answer
Dynamic UIViewCell Vertical Cell scrolling with Horizontal UICollectionViewFlowLayout
I have a collection view that displays a detailed view of an article with dynamic content size.
I have multiple items in the collection view that can be scrolled horizontally.
When the horizontal flow layout is active, the dynamic cell cannot be…

kshitiz_7
- 191
- 2
- 8
2
votes
0 answers
UICollectionViewScrollPosition.top with a UICollectionElementKindSectionHeader
I feel this should be simple to accomplish but for some reason im lost.
I have a button that will scroll a UICollectionView so the cell at an given IndexPath is top of the screen. problem is that the method does not take into account the…

RyanTCB
- 7,400
- 5
- 42
- 62
2
votes
0 answers
How to customize collection view flowlayout cell
I am creating a movie ticket app using collection view. I'm stuck arranging the seats in a collectionView. How to customise the custom flow layout? I want a particular amount of seats in specific rows of the collection view cells
func…

Shakti
- 986
- 12
- 22
2
votes
0 answers
Self resizing for horizontal UICollectionView single row layout - not cell
Use Case:
I have a UICollectionView to display products, let us call it productsViewCollection (only one row with multiple ProductCells).
Each ProductCell may has different height, but all of them have the same width.
ProductCell may be added at…

Mu Sa
- 331
- 3
- 8
1
vote
1 answer
UICollectionView complex grid again
I can't manage to get this type of layout:
I can only achieve this when I set size of cells in 'sizeForItemAt' method:
I tried solutions from Apple like UICollectionViewCompositionalLayout and subclassing of UICollectionViewLayout. But the first…

Maxim
- 33
- 6
1
vote
1 answer
UICollectionView with dynamic sizing cells resets Content Offset on reloadData on iOS 13/14
We successfully created UICollectionView with dynamic sizing cells.
The initial layout is perfect and the cells look good with no warnings. But when we use reloadData after selection occurs the UICollectionView contentOffset resets to zero.
I have…

Roi Mulia
- 5,626
- 11
- 54
- 105
1
vote
0 answers
CollectionView snap item layout
I am trying to find an approach for CollectionView to snap items center point to the center of the screen
In this screenshot vertical black line is center of the screen, item 1 is centered and next item 2 should be centered after swiping

Nika Kirkitadze
- 59
- 2
- 4
1
vote
2 answers
how to implement a uicollectionview that has multiple sections and subsections?
The uicollectionview has n sections (say 1,2,3) that has m subsections (say 1.1,1.2 etc) which further branches into inner subsections (1.1.1, 1.1.2 etc) which finally has X no. of rows in it.

Dracarys
- 31
- 1
- 9
1
vote
1 answer
UICollectionViewCompositionalLayout, but not a repeating pattern
Here is the preview of layout
As you can see this layout has a pattern of cells 0, 1, 2, 0, 1, 2, 0, 1, 2 with respect to the size. I want my layout to depict 0, 1, 2, 1, 2, 1, 2, 1, 2 as the pattern with respect to size.
In other words, just have…

CoderSulemani
- 123
- 11
1
vote
1 answer
how should the math of UICollectionViewFlowLayout spacing work?
I'd like someone could explain clearly how I should calculate the math for the UICollectionViewFlowLayout, exactly "the subtract spacing" thing from itemSize width/height. in this example I get a squared view, 3 items in 3 columns.
why if I…

biggreentree
- 1,633
- 3
- 20
- 35