WaterfallAdapter 类
数据源及事件回调适配器
数据源方法
@note 继承了CollectionViewAdapter所有方法
变量
_priveta_class_name : string
name : string
方法
initHeader
设置初始化Header的回调
function(table header) ... end
header: 视图header, 类型为Lua中的table,表中仅存在一个元素contentView
@note WaterfallView 只有一个header
参数
- callback : function(header)
返回值
fillHeaderData
设置初始化header数据的回调
function(table header, number section, number row) ... end
header: 视图header, 类型为Lua中的table,表中仅存在一个元素contentView
section&row:header的section以及row
@note WaterfallView 只有一个header
参数
返回值
heightForHeader
回调header高度
回调首个header高度,WaterfallView只能有一个header
回调格式:
```
function(number section)
---section: 分组数
end
```
@note 用的时候记得这些参数索引都是从1开始
参数
- callback : function(section)
返回值
headerValid
回调header是否有效
回调首个header高度,WaterfallView只能有一个header
回调格式:
```
function(number section)
---section: 分组数
return true or false
end
```
参数
- callback : function(section)
返回值
heightForCell
回调cell高度
根据组数和行数,回调每个Item的高度
回调格式:
```
function(number section, number row)
---section: 分组数
---row:行数
end
```
@note 用的时候记得这些参数索引都是从1开始
参数
返回值
headerWillAppear
header视图将要显示的回调
header将要展示时候的回调,回调没有任何参数
回调格式:
```
function()
end
```
参数
- callback : function()
返回值
headerDidDisappear
header已经消失的回调
header已经消失的回调
回调格式:
```
function()
end
```
参数
- callback : function()
返回值
sectionCount
设置section数量回调
function()...end
参数
- sectionCountCallback : function()
返回值
rowCount
根据section设置row数量回调
function(number section) ... end
参数
- rowCountCallback : function(section)
返回值
reuseId
设置不同类型cell的id回调
function(number section, number row) ... end
section&row:cell的section以及row
@note 当存在多种类型cell时,reuseId方法与initCellByReusedId、fillCellDataByReuseId等方法配合使用
参数
返回值
initCellByReuseId
根据reuseId设置初始化cell的回调
function(table cell) ... end
cell: 视图cell
@note 当存在多种类型cell时,此方法与reuseId方法配合使用;注意:方法中获取cell中控件宽/高是不准确的
参数
- reuseId : string reuseId:cell类型
- initCellByReuseIdCallback : function(cell)
返回值
fillCellDataByReuseId
根据reuseId设置初始化cell数据的回调
function(table cell, number section, number row) ... end
cell: 视图cell
section&row:cell的section以及row
@note 当存在多种类型cell时,此方法与reuseId方法配合使用;注意:方法中获取cell中控件宽/高是不准确的
参数
返回值
initCell
设置初始化cell的回调
function(table cell) ... end
cell: 视图cell
@note 当仅存在一种cell时,使用此方法;注意:方法中获取cell中控件宽/高是不准确的
参数
- initCellCallback : function(cell)
返回值
fillCellData
设置初始化cell数据的回调
function(table cell, number section, number row) ... end
cell: 视图cell
section&row:cell的section以及row
@note 当仅存在一种cell时,使用此方法;注意:方法中获取cell中控件宽/高是不准确的
参数
返回值
selectedRowByReuseId
根据reuseid设置点击cell的回调
function(table cell, number section, number row) ... end
cell: 视图cell
section&row:cell的section以及row
参数
返回值
selectedRow
设置点击cell的回调
function(table cell, number section, number row) ... end
cell: 视图cell
section&row:cell的section以及row
参数
返回值
longPressRowByReuseId
设置某个reuseID对应cell的长按回调
设置某个reuseID对应cell的长按回调,触发时长0.5s
回调格式:
```
function(table cell,number section,number row)
---cell:cell视图表, 类型为Lua中的table,表中仅存在一个元素contentView
---section:组数
---row:行数
end
```
参数
返回值
longPressRow
设置cell的长按回调
设置cell的长按回调,触发时长0.5s
回调格式:
```
function(table cell,number section,number row)
---cell:cell视图表, 类型为Lua中的table,表中仅存在一个元素contentView
---section:组数
---row:行数
end
```
参数
返回值
sizeForCell
设置cell大小的回调
function(number section, number row) ... end
section&row:cell的section以及row
参数
返回值
sizeForCellByReuseId
根据reuseid设置cell大小的回调
function(table cell, number section, number row) ... end
cell: 视图cell
section&row:cell的section以及row
参数
返回值
cellWillAppear
设置cell将要显示的回调
function(table cell, number section, number row) ... end
cell: 视图cell
section&row:cell的section以及row
参数
返回值
cellDidDisappear
设置cell消失回调
function(table cell, number section, number row) ... end
cell: 视图cell
section&row:cell的section以及row
参数
返回值
cellWillAppearByReuseId
设置指定类型cell将要显示的回调
function(table cell, number section, number row) ... end
cell: 视图cell
section&row:cell的section以及row
参数
返回值
cellDidDisappearByReuseId
设置指定类型cell消失回调
function(table cell, number section, number row) ... end
cell: 视图cell
section&row:cell的section以及row