CollectionViewDelegate

@objc(FWCollectionViewDelegate)
@objcMembers
open class CollectionViewDelegate : NSObject, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout

便捷集合视图代理

  • 集合数据,可选方式,必须按[section][item]二维数组格式

    Declaration

    Swift

    open var collectionData: [[Any]]
  • 集合section数,默认自动计算collectionData

    Declaration

    Swift

    open var countForSection: (() -> Int)?
  • 集合section数,默认0自动计算,优先级低

    Declaration

    Swift

    open var sectionCount: Int
  • 集合item数句柄,默认自动计算collectionData

    Declaration

    Swift

    open var countForItem: ((Int) -> Int)?
  • 集合item数,默认0自动计算,优先级低

    Declaration

    Swift

    open var itemCount: Int
  • 集合section边距句柄,默认nil

    Declaration

    Swift

    open var insetForSection: ((Int) -> UIEdgeInsets)?
  • 集合section边距,默认zero,优先级低

    Declaration

    Swift

    open var sectionInset: UIEdgeInsets
  • 集合section头视图句柄,支持UICollectionReusableView,默认nil

    Declaration

    Swift

    open var viewForHeader: ((IndexPath) -> Any?)?
  • 集合section头视图,支持UICollectionReusableView,默认nil,优先级低

    Declaration

    Swift

    open var headerViewClass: Any?
  • 集合section头视图配置句柄,参数为headerClass对象,默认为nil

    Declaration

    Swift

    open var headerConfiguration: ReusableViewIndexPathBlock?
  • 集合section头尺寸句柄,不指定时默认使用FWDynamicLayout自动计算并按section缓存

    Declaration

    Swift

    open var sizeForHeader: ((Int) -> CGSize)?
  • 集合section头尺寸,默认nil自动根据viewModel计算,可设置为automaticSize,优先级低

    Declaration

    Swift

    open var headerSize: CGSize?
  • 集合section尾视图句柄,支持UICollectionReusableView,默认nil

    Declaration

    Swift

    open var viewForFooter: ((IndexPath) -> Any?)?
  • 集合section尾视图,支持UICollectionReusableView,默认nil,优先级低

    Declaration

    Swift

    open var footerViewClass: Any?
  • 集合section头视图配置句柄,参数为headerClass对象,默认为nil

    Declaration

    Swift

    open var footerConfiguration: ReusableViewIndexPathBlock?
  • 集合section尾尺寸句柄,不指定时默认使用FWDynamicLayout自动计算并按section缓存

    Declaration

    Swift

    open var sizeForFooter: ((Int) -> CGSize)?
  • 集合section尾尺寸,默认nil自动根据viewModel计算,可设置为automaticSize,优先级低

    Declaration

    Swift

    open var footerSize: CGSize?
  • 集合cell类句柄,支持UICollectionViewCell,默认nil

    Declaration

    Swift

    open var cellForItem: ((IndexPath) -> Any?)?
  • 集合cell类,支持UICollectionViewCell,默认nil,优先级低

    Declaration

    Swift

    open var cellClass: Any?
  • 集合cell配置句柄,参数为对应cellClass对象,默认设置fwViewModel为collectionData对应数据

    Declaration

    Swift

    open var cellConfiguration: CollectionCellIndexPathBlock?
  • 集合cell尺寸句柄,不指定时默认使用FWDynamicLayout自动计算并按indexPath缓存

    Declaration

    Swift

    open var sizeForItem: ((IndexPath) -> CGSize)?
  • 集合cell尺寸,默认nil自动根据viewModel计算,可设置为automaticSize,优先级低

    Declaration

    Swift

    open var itemSize: CGSize?
  • 集合选中事件,默认nil

    Declaration

    Swift

    open var didSelectItem: ((IndexPath) -> Void)?

UICollectionView