-
Notifications
You must be signed in to change notification settings - Fork 421
CAPickerView
Picker control, pickerView at least contains one component and each component includes selected sub item (row).
CAView,CATableViewDataSource
Access modifier |
Attribute name |
Description |
protected |
Delegate |
sliding event delegate |
protected |
DataSource |
data delegate |
protected |
FontSizeNormal |
font size in normal status |
protected |
FontSizeSelected |
font size in selected status |
protected |
FontColorNormal |
font color in normal status |
protected |
FontColorSelected |
font color in selected status |
protected |
SeparateColor |
border color of selected border |
Access modifier |
Method name |
Description |
public |
numberOfComponents |
obtain number of components |
public |
numberOfRowsInComponent |
obtain row number of appointed components |
public |
rowSizeForComponent |
obtain appointed components’ size |
public |
viewForRow |
obtain row |
public |
reloadAllComponents |
reload all components |
public |
reloadComponent |
reload appointed components |
public |
selectRow |
appoint selected row |
public |
selectedRowInComponent |
obtain current selected row |
Delegate
Type: CAPickerViewDelegate*
Description: pickerView’s selected event delegate which contains one interface that will be triggered when it’s selected, public get/set{}.
DataSource
Type: CAPickerViewDataSource*
Description: pickerView’s data delegate, please refer to detailed interface of delegate class: CAPickerViewDataSource, public get/set{}.
FontSizeNormal
Type: float
Description: font size of alternative item, public get/set{}.
FontSizeSelected
Type: float
Description: font size of selected item, public get/set{}.
FontColorNormal
Type: CAColor4B
Description: font color of alternative item, public get/set{}.
FontColorSelected
Type: CAColor4B
Description: font color of selected item, public get/set{}.
SeparateColor
Type: CAColor4B
Description: border color of select box, public get/set{}.
virtual int numberOfComponents()
Return value: int
Description: return component number of pickerView
virtual int numberOfRowsInComponent(unsigned int component)
Return value: int
Type |
Parameter name |
Description |
unsigned int |
component |
appointed component |
virtual CCSize rowSizeForComponent(unsigned int component)
Return value: CCSize
Parameter name
Type |
Parameter name |
Description |
unsigned int |
component |
appointed component |
virtual CAView viewForRow(unsigned int row, unsigned int component)*
Return value: CAView*
Parameter:
Type |
Parameter name |
Description |
unsigned int |
row |
appointed row |
unsigned int |
component |
appointed component |
virtual void reloadAllComponents()
Return value: void
Description: reload all components and you must manually reload pickerView once when you build it.
Example:
1 2 3 4 5 6 7 8 9 10 |
pickerView = CAPickerView: : createWithCenter(CCRect(size. width*0. 5, size. height*0. 5, size. width*0. 6, size. height*0. 5)); pickerView->setDelegate(this); pickerView->setDataSource(this); pickerView->setFontSizeNormal(30 * CROSSAPP_ADPTATION_RATIO); pickerView->setFontSizeSelected(30 * CROSSAPP_ADPTATION_RATIO); pickerView->setFontColorNormal(CAColor_blueStyle); pickerView->setFontColorSelected(CAColor_blueStyle); pickerView->setSeparateColor(CAColor_blueStyle); pickerView->reloadAllComponents(); this->getView()->addSubview(pickerView); |
virtual void reloadComponent(unsigned int component, bool bReload = true)
Return value: void
Parameter:
Type |
Parameter name |
Description |
unsigned int |
component |
appointed component |
bool |
bReload |
optional parameters |
virtual void selectRow(unsigned int row, unsigned int component, bool animated = false)
Return value: void
Parameter:
Type |
Parameter name |
Description |
unsigned int |
row |
appointed row |
unsigned int |
component |
appointed component |
bool |
animated |
optional parameters |
virtual int selectedRowInComponent(unsigned int component)
Return value: int
Parameter name
Type |
Parameter name |
Description |
unsigned int |
component |
appointed component |
Please refer to pickerView’s detailed usage in CAPageViewTest example of CrossApp official Demo, path: CrossApp \samples\demo\Classes\PickerViewTest.