AutoLua2AutoLua2
  • 快速开始
  • 介绍
  • 自动化API

    • 图色相关
    • 模拟相关
    • 节点相关
    • 界面相关
    • 其他
  • 界面API
  • 快速开始
  • 介绍
  • 自动化API

    • 图色相关
    • 模拟相关
    • 节点相关
    • 界面相关
    • 其他
  • 界面API
  • 自动化API

    • 图色相关

      • 全局
      • Bitmap
      • FindOrder
    • 模拟相关

      • 全局
      • Pointer
      • KeyCode
    • 节点相关

      • 全局
      • UiObject
      • UiSelector
    • 交互相关

      • 全局
      • UI
      • FloatView
      • FloatController
      • LayoutParams
      • LayoutParamsFlag
    • 其他
  • UI的API

    • 全局变量
    • 视图

      • View 类
      • window 类
      • Label 类
      • ImageButton 类
      • EditTextView 类
      • ScrollView 类
      • LinearLayout 类
      • Alert 类
      • Toast 类
      • Dialog 类
      • Switch 类
      • TabSegmentView 类
      • TableView 类
      • TableViewAdapter 类
      • TableViewAutoFitAdapter 类
      • CollectionView 类
      • CollectionViewAdapter 类
      • CollectionViewAutoFitAdapter 类
      • CollectionViewLayout 类
      • WaterfallView 类
      • WaterfallAdapter 类
      • WaterfallLayout 类
      • ViewPager 类
      • ViewPagerAdapter 类
    • 动画
    • 数据

      • Map 类
      • Array 类
      • Point 类
      • Size 类
      • Rect 类
      • Color 类
      • StyleString 类
    • 工具

      • Loading 类
      • Http 类
      • System 类
      • Timer 类
      • MBit 类
      • File 类
      • Application 类
      • Navigator 类
      • PreferenceUtils 类
      • TypeUtils 类
      • StringUtil 类
      • NetworkReachability 类
      • GlobalEvent 类
      • Clipboard 类
      • CornerManager 类
    • 枚举

      • ContentMode 枚举
      • TextAlign 枚举
      • BreakMode 枚举
      • FontStyle 枚举
      • UnderlineStyle 枚举
      • RepeatType 枚举
      • InterpolatorType 枚举
      • AnimType 枚举
      • EditTextViewInputMode 枚举
      • ReturnType 枚举
      • ScrollDirection 枚举
      • StatusBarStyle 枚举
      • RectCorner 枚举
      • LinearType 枚举
      • Gravity 枚举
      • MeasurementType 枚举
      • ValueType 枚举
      • GradientType 枚举
      • TabSegmentAlignment 枚举
      • NetworkState 枚举
      • CachePolicy 枚举
      • ResponseKey 枚举
      • ErrorKey 枚举
      • EncType 枚举

CollectionViewAdapter 类

CollectionViewAdapter作为VIew以及该View的数据的桥梁,提供数据项的访问以及为每个数据项创建View

变量

_priveta_class_name : string

name : string

方法

sectionCount

设置section数量回调

 function()...end

参数

  • sectionCountCallback : function()

返回值

  • : CollectionViewAdapter

rowCount

根据section设置row数量回调

 function(number section) ... end

参数

  • rowCountCallback : function(section)

返回值

  • : CollectionViewAdapter

reuseId

设置不同类型cell的id回调

 function(number section, number row) ... end 
	 section&row:cell的section以及row

@note 当存在多种类型cell时,reuseId方法与initCellByReusedId、fillCellDataByReuseId等方法配合使用

参数

  • reuseIdCallback : function(section|row)

返回值

  • : CollectionViewAdapter

initCellByReuseId

根据reuseId设置初始化cell的回调

 function(table cell) ... end 
	 cell: 视图cell

@note 当存在多种类型cell时,此方法与reuseId方法配合使用;注意:方法中获取cell中控件宽/高是不准确的

参数

  • reuseId : string reuseId:cell类型
  • initCellByReuseIdCallback : function(cell)

返回值

  • : CollectionViewAdapter

fillCellDataByReuseId

根据reuseId设置初始化cell数据的回调

 function(table cell, number section, number row) ... end 
	 cell: 视图cell 
	 section&row:cell的section以及row

@note 当存在多种类型cell时,此方法与reuseId方法配合使用;注意:方法中获取cell中控件宽/高是不准确的

参数

  • reuseId : string reuseId:cell类型
  • fillCellDataByReuseIdCallback : function(cell|section|row)

返回值

  • : CollectionViewAdapter

initCell

设置初始化cell的回调

 function(table cell) ... end 
	 cell: 视图cell

@note 当仅存在一种cell时,使用此方法;注意:方法中获取cell中控件宽/高是不准确的

参数

  • initCellCallback : function(cell)

返回值

  • : CollectionViewAdapter

fillCellData

设置初始化cell数据的回调

 function(table cell, number section, number row) ... end 
	 cell: 视图cell 
	 section&row:cell的section以及row

@note 当仅存在一种cell时,使用此方法;注意:方法中获取cell中控件宽/高是不准确的

参数

  • fillCellDataCallback : function(cell|section|row)

返回值

  • : CollectionViewAdapter

selectedRowByReuseId

根据reuseid设置点击cell的回调

 function(table cell, number section, number row) ... end 
	 cell: 视图cell 
	 section&row:cell的section以及row

参数

  • reuseId : string reuseId: cell类型
  • selectedRowByReuseIdCallback : function(cell|section|row)

返回值

  • : CollectionViewAdapter

selectedRow

设置点击cell的回调

 function(table cell, number section, number row) ... end 
	 cell: 视图cell 
	 section&row:cell的section以及row

参数

  • selectedRowCallback : function(cell|section|row)

返回值

  • : CollectionViewAdapter

longPressRowByReuseId

设置某个reuseID对应cell的长按回调

设置某个reuseID对应cell的长按回调,触发时长0.5s

 回调格式:
	 ``` 
	 function(table cell,number section,number row) 
	 	 ---cell:cell视图表, 类型为Lua中的table,表中仅存在一个元素contentView 
	 	 ---section:组数 
	 	 ---row:行数 
	 end
	```

参数

  • reuseId : string reuseId:复用ID
  • longPressRowByReuseIdCallback : function(cell|section|row)

返回值

  • : CollectionViewAdapter

longPressRow

设置cell的长按回调

设置cell的长按回调,触发时长0.5s

 回调格式:
	 ``` 
	 function(table cell,number section,number row) 
	 	 ---cell:cell视图表, 类型为Lua中的table,表中仅存在一个元素contentView 
	 	 ---section:组数 
	 	 ---row:行数 
	 end
	```

参数

  • longPressRowCallback : function(cell|section|row)

返回值

  • : CollectionViewAdapter

sizeForCell

设置cell大小的回调

 function(number section, number row) ... end 
	 section&row:cell的section以及row

参数

  • sizeForCellCallback : function(section|row)

返回值

  • : CollectionViewAdapter

sizeForCellByReuseId

根据reuseid设置cell大小的回调

 function(table cell, number section, number row) ... end 
	 cell: 视图cell 
	 section&row:cell的section以及row

参数

  • reuseId : string reuseId:cell类型
  • sizeForCellByReuseIdCallback : function(cell|section|row)

返回值

  • : CollectionViewAdapter

cellWillAppear

设置cell将要显示的回调

 function(table cell, number section, number row) ... end 
	 cell: 视图cell 
	 section&row:cell的section以及row

参数

  • appearCallback : function(cell|section|row)

返回值

  • : CollectionViewAdapter

cellDidDisappear

设置cell消失回调

 function(table cell, number section, number row) ... end 
	 cell: 视图cell 
	 section&row:cell的section以及row

参数

  • disappearCallback : function(cell|section|row)

返回值

  • : CollectionViewAdapter

cellWillAppearByReuseId

设置指定类型cell将要显示的回调

 function(table cell, number section, number row) ... end 
	 cell: 视图cell 
	 section&row:cell的section以及row

参数

  • reuseId : string reuseId:重用Id
  • appearByReuseIdCallback : function(cell|section|row)

返回值

  • : CollectionViewAdapter

cellDidDisappearByReuseId

设置指定类型cell消失回调

 function(table cell, number section, number row) ... end 
	 cell: 视图cell 
	 section&row:cell的section以及row

参数

  • reuseId : string reuseId:重用Id
  • disappearByReuseIdCallback : function(cell|section|row)

返回值

  • : CollectionViewAdapter
Prev
CollectionView 类
Next
CollectionViewAutoFitAdapter 类