更改集合视图单元格大小

时间:2022-11-11 12:25:44

I want to resize FSCalendar's date frame size, which is inside the collectionView cell.

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

Please help me change the collection view cell size in FSCalendar.

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

2 个解决方案

#1


1  

use this function after adding UICollectionViewDelegateFlowLayout :

添加UICollectionViewDelegateFlowLayout后使用此函数:

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

#2


0  

you can use UICollectionView Delegate Methods for changing height and width of CollectionView

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

in Swift

在斯威夫特

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


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

#1


1  

use this function after adding UICollectionViewDelegateFlowLayout :

添加UICollectionViewDelegateFlowLayout后使用此函数:

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

#2


0  

you can use UICollectionView Delegate Methods for changing height and width of CollectionView

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

in Swift

在斯威夫特

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


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