WallPaperHome722/WallpaperHD_Live/Tool/CustomCollectionViewFlowLayout.swift
2024-07-22 15:18:42 +08:00

24 lines
845 B
Swift

//
// CustomCollectionViewFlowLayout.swift
// wallpaper_project
import UIKit
class CustomCollectionViewFlowLayout: UICollectionViewFlowLayout {
override func prepare() {
super.prepare()
guard let collectionView = collectionView else { return }
// let availableWidth = collectionView.bounds.width - sectionInset.left - sectionInset.right - minimumInteritemSpacing
let itemWidth = (collectionView.bounds.width - minimumInteritemSpacing * 3) / 2
itemSize = CGSize(width: itemWidth, height: 300) //
minimumLineSpacing = 10 //
minimumInteritemSpacing = 10 //
sectionInset = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10)
}
}