我有以下代码
//
func setupUI() {
let flowLayout = UICollectionViewFlowLayout()
flowLayout.scrollDirection = .horizontal
flowLayout.itemSize = CGSize(width: CGFloat(collectionItemViewWidth), height: CGFloat(collectionItemViewHeight))
//For Setting the Spacing between cells
flowLayout.minimumInteritemSpacing = 25
flowLayout.minimumLineSpacing = 20
collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectionView.delegate = self
collectionView.dataSource = self
collectionView.translatesAutoresizingMaskIntoConstraints = false
collectionView.showsHorizontalScrollIndicator = false
collectionView.backgroundColor = UIColor.clear
let cellReuseIdentifier = "collectionCell"
self.collectionView.register(LearningItemCollectionViewCell.self, forCellWithReuseIdentifier: cellReuseIdentifier)
self.contentView.addSubview(collectionView)
self.collectionView.delegate = self
self.collectionView.dataSource = self
}
在调用viewDidLoad时调用
在另一个文件DiscoverDiscoverController中,我初始化了上面的CollectionView并调用了setupUI。我使用嵌入了集合视图的表格视图单元格设置了表格视图。有时,我想更改特定行中集合视图单元格的布局项目大小。我该怎么做?