Questions tagged [uicollectionviewcompositionallayout]

206 questions
5
votes
3 answers

How can I set different backgrounds for different sections using compositional layout?

I would like to have different backgrounds for different sections in a collection view using compositional layout. Currently I am using NSCollectionLayoutDecorationItem.background to set the background on a section. However this type of view is not…
5
votes
1 answer

UICollectionViewCompositionalLayout - center items in sections or groups

I set up a collection view and its layout with the new compositional stuff and it has been pretty cool, it seems to be very expandable but I can't find a way to make items centered in the collection, which is IMO a basic feature that one would…
5
votes
1 answer

UICollectionView for non-grid or semi-grid layout

I am trying to implement a multi-row sequence of items (like Video editing sequence in Final Cut Pro or Adobe Premiere pro shown below). While I one can always implement it using UIScrollView and placing custom views manually, it would be tedious…
5
votes
1 answer

Collection View Diffable Data Source cells disappearing and not resizing properly?

I'm having a really weird issue with my collection view. I'm using the Compositional Layout and Diffable Data Source APIs for iOS 13+, but I'm getting some really weird behavior. As seen in the video below, when I update the data source, the first…
4
votes
1 answer

UICollectionViewCompositionalLayout Dynamic Heights Causing Layout Adjustments and Flickering

I'm using UICollectionViewCompositionalLayout to create a vertically scrolling list of horizontally scrolling (orthogonally scrolling) lists in my iOS app. When I specify an estimated height for both the item and the group, the collection view…
Aodh
  • 662
  • 1
  • 7
  • 24
4
votes
1 answer

Collection view self-sizing cells issue in Compositional layout

I am using a collection view compositional layout to display a cell with two labels that can grow in height, depending on the content of the labels. Everything else in the cell is fixed. I make a section like this: let item =…
4
votes
0 answers

scrollToItem() causes compositional layout to glitch when using paging

I'm using UICollectionViewCompositionalLayout and the *UICollectionLayoutSectionOrthogonalScrollingBehavior to build a carousel. The scrollToItem() method will correctly scroll to the item at the specified indexPath but will create a top-inset…
David Schmoecker
  • 567
  • 3
  • 8
  • 17
4
votes
3 answers

How to deal with empty items section in UICollectionView CompositionalLayout

I'm trying to make collection view with compositional layout which have multi sections but if there is empty items in sections how can I deal with it? if item is empty I don't want to show that section UICollectionViewCompositionalLayout { (section,…
4
votes
0 answers

How do I create stretchy header in compositional layout?

class StretchyHeader: UICollectionViewFlowLayout { override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { let layoutAttributes = super.layoutAttributesForElements(in: rect)! as…
4
votes
1 answer

Compositional Layout item with .estimated width crashes app when content is too long

I'm exploring the amazing world of using Compositional Layout and I've found a small situation that I need help with. Below there is a simple app that uses a CollectionView with CL to display random strings using a UIListContentConfiguration rounded…
4
votes
1 answer

Page control in compositional layout collection view

I'm trying to use pageControl option in compositional layout collection view.I already referred some previous questions related to same topic, like this Trying to hook up Compositional Layout CollectionView with PageControl.…
4
votes
1 answer

UICollectionVIew Compositional Layout & DiffableDataSource, how to enable data prefetching?

How to enable data prefetching when using the new Compositional Layout & DiffableDataSource? Before, we can achieve this by conforming a custom data source object, like, class CustomDataSource: NSObject, UICollectionViewDataSource,…
4
votes
1 answer

How to make a UICollectionView global header and/or footer?

I’ve been trying to create a UICollectionView header that would stick on top of my collection view. I’m using UICollectionViewCompositionalLayout. I’ve tried multiple approaches: using a cell, using a section header and try to mess with insets and…
4
votes
1 answer

Can make this layout with a UICollectionViewCompositionalLayout

I am trying to create a 'tag cloud' section using a UICollectionViewCompositionalLayout I would like a full width section of items followed by a section that wraps in this fashion Essential HR, Financial Wellbeing and Employee engagement would each…
4
votes
0 answers

UICollectionViewCompositionalLayout orthogonal section willDisplayCell analytics

I'm using Collection View Compositional Layout and need to have accurate analytics for "userViewedCell" events for orthogonally scrolling sections. I had been using collectionView(willDisplay:forItemAt) to detect when a cell is about to be shown,…
1
2
3
13 14