CAPickerViewDataSource

2018-09-08 15:31 更新

类说明

        CAPickerView的数据代理


CAPickerViewDataSource 方法(点击查看方法介绍)

方法说明
numberOfComponentsInPickerView设定component的数量
numberOfRowsInComponent设定component中row的数量
widthForComponent设定component的宽
rowHeightForComponent设定row的高
titleForRow设定row的显示内容
viewForRow设定备选row的view
viewForSelect设定选中row的view


CAPickerViewDataSource 方法说明

virtual unsigned int numberOfComponentsInPickerView(CAPickerView* pickerView) = 0

返回值:unsigned int

参数:

类型参数名说明
CAPickerView*pickerView当前pickerView

类型 参数名 说明

CAPickerView* pickerView 当前pickerView

解释:设定component的数量


virtual unsigned int numberOfRowsInComponent(CAPickerView* pickerView, unsigned int component) = 0

返回值:unsigned int

参数:

类型参数名说明
CAPickerView*pickerView当前pickerView
unsigned intcomponent当前的component

解释:设定component中row的数量


virtual float widthForComponent(CAPickerView* pickerView, unsigned int component) {return 0;}

返回值:float

参数:

类型参数名说明
CAPickerView*pickerView当前pickerView
unsigned intcomponent当前的component

解释:设定component的宽

 

virtual float rowHeightForComponent(CAPickerView* pickerView, unsigned int component) {return 0;}

返回值:float

参数:

类型参数名说明
CAPickerView*pickerView当前pickerView
unsigned intcomponent当前的component

解释:设定row的高

 

virtual CCString* titleForRow(CAPickerView* pickerView, unsigned int row, unsigned int component) {return NULL;}

返回值:CCString*

参数:

类型参数名说明
CAPickerView*pickerView当前pickerView
unsigned introw当前的row
unsigned intcomponent当前的component

解释:设定row的显示内容

 

virtual CAView* viewForRow(CAPickerView* pickerView, unsigned int row, unsigned int component) {return NULL;}

返回值:CAView*

参数:

类型参数名说明
CAPickerView*pickerView当前pickerView
unsigned introw当前的row
unsigned intcomponent当前的component

解释:设定row的显示内容

 

virtual CAView* viewForSelect(CAPickerView* pickerView, unsigned int component, const CCSize& size) {return NULL;}

返回值:CAView*

参数:

类型参数名说明
CAPickerView*pickerView当前pickerView
unsigned intcomponent当前的component
const CCSize&size被选中row的size

解释:设定选中row的view

以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号