TableView Documentation

Class Table​View.​Group

public class Group  

表格的Group对象

Member Of

TableView

一个表格的数据源 可以快速搭建基于UITableView的列表或者复杂的UI界面,支持高度自动计算,自动缓存高度,便捷的高度刷新。

Nested Type Aliases

Add​Cell​Block

public typealias AddCellBlock = (_ cell:Cell) -> Void

Group添加Cell

Parameters

cell

添加的Cell对象

Add​Header​Footer​Block

public typealias AddHeaderFooterBlock = (_ headerFooter:HeaderFooter) -> Void

Group添加Header或者Footer

Parameters

header​Footer

添加的Header或者Footer对象

Properties

table​View

public weak var tableView:UITableView? 

弱引用数据源托管的UITableView

cellls

public var cellls:[Cell] = [] 

分组对应添加的Cell

header

public var header:HeaderFooter? 

UITableView对应Header的配置

footer

public var footer:HeaderFooter? 

UITableView对应的Footer的配置

Methods

add​Cell(_:​_:​identifier:​)

public func addCell<C:UITableViewCell>(_ type:C.Type,
                                               _ block:AddCellBlock,
                                               identifier:String = "\(C.self)")  

添加一个或者一组的Cell

Parameters

type C.​Type

对应UITableViewCell或者子类的类型

block Add​Cell​Block

配置Cell

identifier String

自定义标识符 默认为UITableViewCell对象类型的类名

add​Header(_:​_:​identifier:​)

public func addHeader<HF:UITableViewHeaderFooterView>(_ type:HF.Type,
                                                              _ block:AddHeaderFooterBlock,
                                                              identifier:String = "\(HF.self)")  

添加一个Header

Parameters

type HF.​Type

对应UITableViewHeaderFooterView或者子类的类型

block Add​Header​Footer​Block

配置Header闭包

identifier String

自定义标识符 默认为UITableViewHeaderFooterView对象的类名

add​Footer(_:​_:​identifier:​)

public func addFooter<HF:UITableViewHeaderFooterView>(_ type:HF.Type,
                                                              _ block:AddHeaderFooterBlock,
                                                              identifier:String = "\(HF.self)")  

添加一个Footer

Parameters

type HF.​Type

UITableViewHeaderFooterView或者子类类型

block Add​Header​Footer​Block

配置Footer

identifier String

自定义标识符 默认为UITableViewHeaderFooterView对象的类名

cell​Count()

public func cellCount() -> Int  

获取对应分组下面UITableViewCell个数

Returns

UITableViewCell个数

cell​Index(index​Path:​)

public func cellIndex(indexPath:IndexPath) -> (Cell,Int)?  

获取IndexPath对应Cell和在Cell的索引

Parameters

index​Path Index​Path

当前的IndexPath

Returns

对应Cell数据源和Cell对应的索引的元组