25 lines
740 B
Swift
25 lines
740 B
Swift
//
|
|
// CollectionViewFlowLayout.swift
|
|
// Funny_sounds
|
|
//
|
|
// Created by 忆海16 on 2024/8/15.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
class CustomCollectionViewFlowLayout: UICollectionViewFlowLayout {
|
|
override func prepare() {
|
|
super.prepare()
|
|
|
|
guard let collectionView = collectionView else { return }
|
|
|
|
let itemWidth = (collectionView.bounds.width - minimumInteritemSpacing * 3) / 2
|
|
|
|
itemSize = CGSize(width: itemWidth, height: 230) // 设置每个单元格的大小
|
|
minimumLineSpacing = 10 // 设置行间距
|
|
minimumInteritemSpacing = 10 // 设置列间距
|
|
sectionInset = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10)
|
|
}
|
|
}
|