Created
May 27, 2020 06:14
-
-
Save tokorom/07728b5ca4989c5f7fe77c66c457d375 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let itemHeight: CGFloat = 96 | |
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .estimated(itemHeight)) | |
let item = NSCollectionLayoutItem(layoutSize: itemSize) | |
let group = NSCollectionLayoutGroup.horizontal(layoutSize: itemSize, subitem: item, count: 1) | |
let section = NSCollectionLayoutSection(group: group) | |
section.interGroupSpacing = 16 | |
section.contentInsets = NSDirectionalEdgeInsets(top: 20, leading: 20, bottom: 20, trailing: 20) | |
return UICollectionViewCompositionalLayout(section: section) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let itemHeight: CGFloat = 96 | |
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .estimated(itemHeight)) | |
let item = NSCollectionLayoutItem(layoutSize: itemSize) | |
let group = NSCollectionLayoutGroup.vertical(layoutSize: itemSize, subitem: item, count: 1) | |
let section = NSCollectionLayoutSection(group: group) | |
section.interGroupSpacing = 16 | |
section.contentInsets = NSDirectionalEdgeInsets(top: 20, leading: 20, bottom: 20, trailing: 20) | |
return UICollectionViewCompositionalLayout(section: section) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
layout_horizontal.swift
だとCellの中身のUILabelの高さに応じてCellの高さが変わるlayout_vertical.swift
だとCellの中身のUILabelの高さに応じてCellの高さが変わらず