TableViewDelegate

@MainActor
open class TableViewDelegate : DelegateProxy<UITableViewDelegate>, UITableViewDelegate, UITableViewDataSource

常用表格视图数据源和事件代理,可继承

  • 表格section数

    Declaration

    Swift

    @MainActor
    open var numberOfSections: (() -> Int)?
  • 表格section数,默认1,优先级低

    Declaration

    Swift

    @MainActor
    open var sectionCount: Int
  • 表格row数句柄

    Declaration

    Swift

    @MainActor
    open var numberOfRows: ((Int) -> Int)?
  • 表格row数,优先级低

    Declaration

    Swift

    @MainActor
    open var rowCount: Int
  • 表格section头视图句柄,高度未指定时automaticDimension,默认nil

    Declaration

    Swift

    @MainActor
    open var viewForHeader: ((UITableView, Int) -> UIView?)?
  • 表格section头视图类句柄,搭配headerConfiguration使用,默认nil

    Declaration

    Swift

    @MainActor
    open var viewClassForHeader: ((UITableView, Int) -> UITableViewHeaderFooterView.Type?)?
  • 表格section头视图类,搭配headerConfiguration使用,默认nil,优先级低

    Declaration

    Swift

    @MainActor
    open var headerViewClass: UITableViewHeaderFooterView.Type?
  • 表格section头视图配置句柄,参数为headerClass对象,默认为nil

    Declaration

    Swift

    @MainActor
    open var headerConfiguration: ((UITableViewHeaderFooterView, Int) -> Void)?
  • 表格section头高度句柄,不指定时默认使用DynamicLayout自动计算并按section缓存

    Declaration

    Swift

    @MainActor
    open var heightForHeader: ((UITableView, Int) -> CGFloat)?
  • 表格section头高度,默认nil,可设置为automaticDimension,优先级低

    Declaration

    Swift

    @MainActor
    open var headerHeight: CGFloat?
  • 表格section尾视图句柄,高度未指定时automaticDimension,默认nil

    Declaration

    Swift

    @MainActor
    open var viewForFooter: ((UITableView, Int) -> UIView?)?
  • 表格section尾视图类句柄,搭配footerConfiguration使用,默认nil

    Declaration

    Swift

    @MainActor
    open var viewClassForFooter: ((UITableView, Int) -> UITableViewHeaderFooterView.Type?)?
  • 表格section尾视图,搭配footerConfiguration使用,默认nil,优先级低

    Declaration

    Swift

    @MainActor
    open var footerViewClass: UITableViewHeaderFooterView.Type?
  • 表格section头视图配置句柄,参数为headerClass对象,默认为nil

    Declaration

    Swift

    @MainActor
    open var footerConfiguration: ((UITableViewHeaderFooterView, Int) -> Void)?
  • 表格section尾高度句柄,不指定时默认使用FWDynamicLayout自动计算并按section缓存

    Declaration

    Swift

    @MainActor
    open var heightForFooter: ((UITableView, Int) -> CGFloat)?
  • 表格section尾高度,默认nil,可设置为automaticDimension,优先级低

    Declaration

    Swift

    @MainActor
    open var footerHeight: CGFloat?
  • 表格cell视图句柄,高度未指定时automaticDimension,默认nil

    Declaration

    Swift

    @MainActor
    open var cellForRow: ((UITableView, IndexPath) -> UITableViewCell?)?
  • 表格cell视图类句柄,搭配cellConfiguation使用,默认nil

    Declaration

    Swift

    @MainActor
    open var cellClassForRow: ((UITableView, IndexPath) -> UITableViewCell.Type?)?
  • 表格cell视图类,搭配cellConfiguation使用,默认nil时为UITableViewCell.Type,优先级低

    Declaration

    Swift

    @MainActor
    open var cellClass: UITableViewCell.Type?
  • 表格cell配置句柄,参数为对应cellClass对象

    Declaration

    Swift

    @MainActor
    open var cellConfiguation: ((UITableViewCell, IndexPath) -> Void)?
  • 表格cell高度句柄,不指定时默认使用FWDynamicLayout自动计算并按indexPath缓存

    Declaration

    Swift

    @MainActor
    open var heightForRow: ((UITableView, IndexPath) -> CGFloat)?
  • 表格cell高度,默认nil,可设置为automaticDimension,优先级低

    Declaration

    Swift

    @MainActor
    open var rowHeight: CGFloat?
  • 是否启用默认高度缓存,优先级低于cacheKey句柄,默认false

    Declaration

    Swift

    @MainActor
    open var heightCacheEnabled: Bool
  • 表格cell自定义高度缓存key句柄,默认nil,优先级高

    Declaration

    Swift

    @MainActor
    open var cacheKeyForRow: ((IndexPath) -> AnyHashable?)?
  • 表格section头自定义高度缓存key句柄,默认nil,优先级高

    Declaration

    Swift

    @MainActor
    open var cacheKeyForHeader: ((Int) -> AnyHashable?)?
  • 表格section尾自定义高度缓存key句柄,默认nil,优先级高

    Declaration

    Swift

    @MainActor
    open var cacheKeyForFooter: ((Int) -> AnyHashable?)?
  • 表格选中事件,默认nil

    Declaration

    Swift

    @MainActor
    open var didSelectRow: ((UITableView, IndexPath) -> Void)?
  • 表格删除标题句柄,不为空才能删除,默认nil不能删除

    Declaration

    Swift

    @MainActor
    open var titleForDelete: ((IndexPath) -> String?)?
  • 表格删除标题,不为空才能删除,默认nil不能删除,优先级低

    Declaration

    Swift

    @MainActor
    open var deleteTitle: String?
  • 表格删除事件,默认nil

    Declaration

    Swift

    @MainActor
    open var didDeleteRow: ((UITableView, IndexPath) -> Void)?
  • 表格cell即将显示句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var willDisplayCell: ((UITableViewCell, IndexPath) -> Void)?
  • 表格cell即将停止显示,默认nil

    Declaration

    Swift

    @MainActor
    open var didEndDisplayingCell: ((UITableViewCell, IndexPath) -> Void)?
  • 表格滚动句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var didScroll: ((UIScrollView) -> Void)?
  • 表格即将开始拖动句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var willBeginDragging: ((UIScrollView) -> Void)?
  • 表格即将停止拖动句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var willEndDragging: ((UIScrollView, CGPoint, UnsafeMutablePointer<CGPoint>) -> Void)?
  • 表格已经停止拖动句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var didEndDragging: ((UIScrollView, Bool) -> Void)?
  • 表格已经停止减速句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var didEndDecelerating: ((UIScrollView) -> Void)?
  • 表格已经停止滚动动画句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var didEndScrollingAnimation: ((UIScrollView) -> Void)?

Lifecycle

  • 初始化并绑定tableView

    Declaration

    Swift

    @MainActor
    public convenience init(tableView: UITableView)

UITableViewDataSource

  • Undocumented

    Declaration

    Swift

    @MainActor
    open func numberOfSections(in tableView: UITableView) -> Int
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath)

UITableViewDelegate

UIScrollViewDelegate