更改集合视图单元格大小

Change the collection view cell size

我想调整 FSCalendar 的日期框大小,它位于 collectionView 单元格内。

请帮我更改 FSCalendar 中的集合视图单元格大小。

您可以使用 UICollectionView 委托方法来更改 CollectionView 的高度和宽度

在Swift

public func collectionView(_ collectionView: UICollectionView, transitionLayoutForOldLayout fromLayout: UICollectionViewLayout, newLayout toLayout: UICollectionViewLayout) -> UICollectionViewTransitionLayout


func setCollectionViewLayout(_ layout: UICollectionViewLayout, animated: Bool)

添加 UICollectionViewDelegateFlowLayout 后使用此功能:

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
         return CGSize(width: screenWidth, height: screenWidth)
    }