CollectionViewAdapter 类
CollectionViewAdapter作为VIew以及该View的数据的桥梁,提供数据项的访问以及为每个数据项创建View
变量
_priveta_class_name : string
name : string
方法
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