uicollectionviewcompositionallayout

How to create a grid layout with equal row heights using UICollectionViewCompositionalLayout

隐身守侯 提交于 2021-02-06 12:05:07
问题 I've successfully been able to create a grid layout using UICollectionViewCompositionalLayout . However, I am unable to find a clever way of ensuring the UICollectionViewCell in each row in the grid are of the same height when their heights are dynamic. i.e. I want the cell to stretch to fill the available space height-wise in the row. Desired layout: Grid (3 x N) Variable height cells Each cell has the same height in a given row. (uses the max cell height in a row) Small divider line at the

How to create a grid layout with equal row heights using UICollectionViewCompositionalLayout

孤街浪徒 提交于 2021-02-06 11:56:10
问题 I've successfully been able to create a grid layout using UICollectionViewCompositionalLayout . However, I am unable to find a clever way of ensuring the UICollectionViewCell in each row in the grid are of the same height when their heights are dynamic. i.e. I want the cell to stretch to fill the available space height-wise in the row. Desired layout: Grid (3 x N) Variable height cells Each cell has the same height in a given row. (uses the max cell height in a row) Small divider line at the

Self-sizing cells with UICollectionViewCompositionalLayout

蹲街弑〆低调 提交于 2021-01-29 05:11:57
问题 I have a view controller that displays a collection view with self-sizing cells. The collection view has one section that scrolls horizontally. It looks like this: Problem The collection view behaves unexpectedly when the view controller is presented using the default pageSheet style on iOS 13+. When pulling upward on the sheet, cells may appear to resize like the cell labeled "Rectify" below: When pulling upward on the sheet, the content may shift horizontally. Sometimes, cells may disappear

Self-sizing cells with UICollectionViewCompositionalLayout

大兔子大兔子 提交于 2021-01-29 05:08:34
问题 I have a view controller that displays a collection view with self-sizing cells. The collection view has one section that scrolls horizontally. It looks like this: Problem The collection view behaves unexpectedly when the view controller is presented using the default pageSheet style on iOS 13+. When pulling upward on the sheet, cells may appear to resize like the cell labeled "Rectify" below: When pulling upward on the sheet, the content may shift horizontally. Sometimes, cells may disappear

UICollectionViewCompositionalLayout - center items in sections or groups

戏子无情 提交于 2021-01-07 02:46:41
问题 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 imagine being supported.. What I have is: Accomplished with this code: UICollectionViewCompositionalLayout { section, env in let tagDefaultSize = CGSize(width: 100, height: 40) let item = NSCollectionLayoutItem( layoutSize: NSCollectionLayoutSize

diffable data source section header blinks during update

我与影子孤独终老i 提交于 2021-01-05 13:19:37
问题 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 issue before? I update the data source via: var snapshot = NSDiffableDataSourceSnapshot<Section, Item>() snapshot.appendSections(Sections.allCases) items.forEach { snapshot.appendItems([$0], toSection: ItemSectionMapper.getSection(for: $0)) } self

diffable data source section header blinks during update

社会主义新天地 提交于 2021-01-05 13:18:47
问题 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 issue before? I update the data source via: var snapshot = NSDiffableDataSourceSnapshot<Section, Item>() snapshot.appendSections(Sections.allCases) items.forEach { snapshot.appendItems([$0], toSection: ItemSectionMapper.getSection(for: $0)) } self

UICollectionViewCompositionalLayout: control number of items in a group with fractional group width

馋奶兔 提交于 2020-05-14 03:35:09
问题 Using UICollectionViewCompositionalLayout , I'd like to render a specific number of items in one group and a specific number of items in another group This is a simplified version of the layout I came up with: func createTestSectionLayout(noTextItems: Int, noImageItems: Int) -> NSCollectionLayoutSection { // noTextItems texts can have different lengths let textItemSize = NSCollectionLayoutSize(widthDimension: .estimated(80), heightDimension: .estimated(44)) var textItems =