CCControlStepper的使用
来源:互联网 发布:苹果电脑的解压缩软件 编辑:程序博客网 时间:2024/05/21 09:30
2.0后加了一个点击“+”“—”来改变数值的控件CCControlStepper
(1)显示
// label6_3CCLabelTTF* label6_3 = CCLabelTTF::create("8", "HelveticaNeue-Bold", 15, CCSizeMake(70,30), kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter);label6_3->setPosition(_TVCC_LABEL6_3_POS);this->addChild(label6_3, 10, 603);// label6_3's backgroundCCScale9Sprite* background6_3 = CCScale9Sprite::create("cityBuilding/cityBuildingInfo/cityCenter/buttonBackground.png");background6_3->setContentSize(CCSizeMake(40, 20));background6_3->setPosition(_TVCC_BACKGROUND6_3_POS);this->addChild(background6_3);// stepper6_3CCControlStepper* stepper6_3 = CCControlStepper::create(CCSprite::create("cityBuilding/cityBuildingInfo/cityCenter/stepper-minus.png"), CCSprite::create("cityBuilding/cityBuildingInfo/cityCenter/stepper-plus.png"));stepper6_3->setPosition(_TVCC_STEPPER6_3_POS);stepper6_3->setScale(0.6);stepper6_3->setMaximumValue(24);// 最大值stepper6_3->setValue(8);// 起始值stepper6_3->addTargetWithActionForControlEvents(this, cccontrol_selector(TVCityCenter::valueChanged6_3), CCControlEventValueChanged);this->addChild(stepper6_3);
(2)回调函数
// "保护时间"模块中stepper6_3值改变回调函数void TVCityCenter::valueChanged6_3(CCObject* sender, CCControlEvent controlEvent){CCControlStepper* pControl = (CCControlStepper*)sender;int theValue = pControl->getValue();// Change value of label.CCLabelTTF* label = (CCLabelTTF*)this->getChildByTag(603);label->setString(CCString::createWithFormat("%d", theValue)->getCString());}
- CCControlStepper的使用
- Cocos2d-x中控件CCControlStepper的使用
- CCControlExtension/CCControlStepper
- CCControlStepper学习笔记
- GUID使用的使用
- ${}的使用
- 的使用
- @[],@()的使用
- ->的使用
- +、-、*、/、%的使用
- &&的使用
- %:的使用
- Makefile中使用$$的使用
- Makefile中使用$$的使用
- Red5的使用--使用日志
- prefernce的使用具体使用
- 【工具使用】git 的使用
- 关于使用AsyncTaskLoader的使用
- winhex恢复误GHOST系统造成的数据丢失
- chromium 书签实现机制
- AsyncTask的用法
- erlang 的 DNS 解析
- 详细信息 - 1: IOR 文件“/tmp/gconfd-root/lock/ior”没有成功打开
- CCControlStepper的使用
- Ubuntu中安装VMTools
- 固网+G网业务营销方案
- 简单的多线程
- template class build errors in android
- CSS Sprites的原理和使用
- 作文顿悟
- 将截断字符串或二进制数据。
- 无题