Questions tagged [uicollectionviewcompositionallayout]
206 questions
2
votes
0 answers
Remove groupPagingCentered for first and last groups compositionalLayout
I use Compositional Layout to create collectionView which its items in each section are centered (with the option of .groupPagingCentered). However, I don't want the first and last groups (=items) to be centered, but to align right and left,…

Chaya
- 21
- 2
2
votes
2 answers
Section Header For Particular Section Using UICollectionLayoutListConfiguration
I have a UICollectionView with 2 sections using UICollectionLayoutListConfiguration. I want to have a Header for only one of those particular sections.
COLLECTION VIEW
lazy var collectionView: UICollectionView = {
var list =…

David Henry
- 1,972
- 20
- 43
2
votes
2 answers
How do I prevent my section headers from overlapping cells in a compositional layout
I want a header to appear above each section in my compositional layout, but I can't find a way to make them appear above the content rather than overlapping it, here is my layout code:
func createLayout() -> UICollectionViewLayout {
let…

Halpo
- 2,982
- 3
- 25
- 54
2
votes
2 answers
Dynamic Cell Width In Compositional Layout
I am looking to achieve the below illustration. Essentially it is a horizontal 'section' within a UICompositionalLayout where the cells size to the text.
The issue I am having is that if the cell doesn't fit onto the screen it will offset to the…

David Henry
- 1,972
- 20
- 43
2
votes
0 answers
UICollectionViewCompositionalLayout can support manual calculate height (or width)?
My UICollectionView used the method in YYKit before, first, calculate the frame of the data and store it in the ViewModel. Update the height of the cell as a Layout delegate. This eliminates the need to calculate the height of the cell while…

viviyoung
- 99
- 6
2
votes
1 answer
Vertical full screen paging using UICollectionViewCompositionalLayout
I'm attempting to create a vertically paging UICollectionView using UICollectionViewCompositionalLayout, similar to how TikTok scrolls its feed. I'm very close to achieving that experience, however, the cells aren't being sized the way I expect them…

hellaandrew
- 823
- 11
- 23
2
votes
1 answer
How to make the height of a group of a UICollectionView compositional layout equal to the largest UICollectionViewCell in the group?
As you can see in the image below, I have a UICollectionViewCell that contains an UIImageView with a fixed-height image. Below the UIImageView there is a vertical UIStackView that contains all the labels and sub-stackviews with the title, price…

Alexandros Athanasiadis
- 193
- 1
- 1
- 5
2
votes
0 answers
UICollectionView Compositional Layout: Orthogonal ScrollView shifted upwards
I created a UICollectionView using the CompositionalLayout and DiffableDatasource APIs. Everything works and looks as expected, except for the Orthogonal ScrollView that is shifted upwards.
The following screenshot shows the relevant portion of my…

Medwe
- 318
- 1
- 12
2
votes
1 answer
Compositional Layout doesn't resize height correctly of “_UICollectionViewOrthogonalScrollerEmbeddedScrollView” causing a button to not receive events
I am having a problem with a collection view using a compositional layout! the Card section supposed to be auto-resizing for the height and it should be scrolling horizontally while the whole collection view vertically as this test project!
The…

Ehab Saifan
- 290
- 2
- 13
2
votes
0 answers
UICollectionViewDiffableDataSource custom subclass initialization
So I am making a custom subclass of UICollectionViewDiffableDataSource.
My code looks like this :
class MyDiffableDataSource: UICollectionViewDiffableDataSource {
convenience required init(collectionView: UICollectionView)…
user15102768
2
votes
1 answer
UICollectionViewCompositionalLayout waterfall
Could someone please guide me in how to create a "waterfall" layout. What I've so far created is below. But as you can see I want the spacing removed.
func createTwoColumnsLayout() -> UICollectionViewLayout {
let itemSize =…

Peter Warbo
- 11,136
- 14
- 98
- 193
2
votes
0 answers
Place the NSCollectionLayoutSupplementaryItem at the bottom of the containing group
The context:
I'm creating cells using the UICollectionViewCompositionalLayout and an estimated height, based on dynamic text within the cells. Each cell has a supplementary item (a button) in the bottom trailing corner. A small excerpt of the code…

Gerald Eersteling
- 1,244
- 14
- 28
2
votes
0 answers
UICollectionViewCompositionalLayout equal item height using autolayout
I'm using a UICollectionViewCompositionalLayout to create a grid. Each cell contains a multi-line label. My goal is that, when 1 item in a group/row grows, all others in that group/row grow to the same height e.g. in the attached pic, I would like…

RunLoop
- 20,288
- 21
- 96
- 151
2
votes
2 answers
UICollectionViewCompositionalLayout with group width smaller than the section width and paging
I see this kind of code in each tutorial that tries to recreate the AppStore layout:
...
let group = NSCollectionLayoutGroup.horizontal(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.95), heightDimension: .absolute(300)),…

lawicko
- 7,246
- 3
- 37
- 49
2
votes
1 answer
diffable data source section header blinks during update
I'm currently facing the issue, that when applying a new snapshot to my current data source, that the header, footer and decoration views are not part of the collection view's subviews, which can be noticed as a weird flicker. Did anyone face that…

Carsten
- 581
- 4
- 17