本文整理汇总了C++中CCTableViewCell::removeChildByTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CCTableViewCell::removeChildByTag方法的具体用法?C++ CCTableViewCell::removeChildByTag怎么用?C++ CCTableViewCell::removeChildByTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCTableViewCell
的用法示例。
在下文中一共展示了CCTableViewCell::removeChildByTag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tableCellAtIndex
CCTableViewCell* ItemListScene::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
CCTableViewCell *cell = table->dequeueCell();
CCLabelTTF *itemNumberLabel = NULL;
CCLabelTTF *itemNameLabel = NULL;
if (!cell) {
cell = new CCTableViewCell();
cell->autorelease();
itemNumberLabel = CCLabelTTF::create("", DefaultFontName, FontSizeNormal);
itemNumberLabel->setAnchorPoint(ccp(0.0, 0.5));
itemNumberLabel->setPosition(ccp(kItemNumberLabelMarginLeft, kItemCellHeight / 2));
itemNumberLabel->setTag(kItemCellTagNumberLabel);
cell->addChild(itemNumberLabel);
itemNameLabel = CCLabelTTF::create("", DefaultFontName, FontSizeNormal);
itemNameLabel->setAnchorPoint(ccp(0.0, 0.5));
itemNameLabel->setPosition(ccp(kItemNameLabelMarginLeft, kItemCellHeight / 2));
itemNameLabel->setTag(kItemCellTagNameLabel);
cell->addChild(itemNameLabel);
}
Item item = selectedItem(idx);
cell->removeChildByTag(kItemCellTagImage);
itemNumberLabel = (CCLabelTTF *)cell->getChildByTag(kItemCellTagNumberLabel);
itemNumberLabel->setString(CCString::createWithFormat("%02lld", item.get_id())->getCString());
CCSprite *itemImage = NULL;
itemNameLabel = (CCLabelTTF *)cell->getChildByTag(kItemCellTagNameLabel);
if (item->count > 0) {
itemImage = CCSprite::createWithSpriteFrameName(item->image.c_str());
itemNameLabel->setString(item->name.c_str());
}
else {
itemImage = CCSprite::createWithSpriteFrameName(NotFoundItemImage);
itemNameLabel->setString(MessageNotFoundItemNameText);
}
itemImage->setAnchorPoint(ccp(0.0, 0.5));
itemImage->setPosition(ccp(kItemImageMarginLeft, kItemCellHeight / 2));
itemImage->setTag(kItemCellTagImage);
cell->addChild(itemImage);
return cell;
}
示例2: tableCellAtIndex
CCTableViewCell* MyScrollView::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
CCLOG("idx = %d", idx);
CCTableViewCell *cell = table->dequeueCell();
CCSprite *sprite;
switch(idx)
{
case 0:
sprite = CCSprite::create("bangzhuguanyu/1.png");
break;
case 1:
sprite = CCSprite::create("bangzhuguanyu/2.png");
break;
case 2:
sprite = CCSprite::create("bangzhuguanyu/3.png");
break;
case 3:
sprite = CCSprite::create("bangzhuguanyu/4.png");
break;
case 4:
sprite = CCSprite::create("bangzhuguanyu/5.png");
break;
case 5:
sprite = CCSprite::create("bangzhuguanyu/6.png");
break;
case 6:
sprite = CCSprite::create("bangzhuguanyu/7.png");
break;
default:
break;
}
if (!cell) {
cell = new CCTableViewCell();
cell->autorelease();
sprite->setAnchorPoint(CCPointZero);
sprite->setPosition(ccp(0, 0));
sprite->setTag(123);
cell->addChild(sprite);
}
else
{
cell->removeChildByTag(123);
sprite->setAnchorPoint(CCPointZero);
sprite->setPosition(ccp(0, 0));
sprite->setTag(123);
cell->addChild(sprite);
}
return cell;
}
示例3: tableCellAtIndex
CCTableViewCell* MallMarkets::tableCellAtIndex(cocos2d::extension::CCTableView *table, unsigned int idx)
{
//CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCSize tableCellSize = CCSizeMake(1136, 100);
CCTableViewCell *pCell = table->dequeueCell();
string temp = this->coinImageName[idx];
string imagePath = writablePathLocal+temp;
CCSprite *prizePicture = CCSprite::create(imagePath.c_str());
prizePicture->setAnchorPoint(CCPointZero);
prizePicture->setPosition(ccp(20, 60));
prizePicture->setScale(1);
prizePicture->setTag(122);
//pCell->addChild(prizePicture);
if (!pCell) {
pCell = new CCTableViewCell();
pCell->autorelease();
//1.表格背景ZF_Shoot_Button_gridItem
CCSprite *pSprite = CCSprite::create("ZF_Shoot_Button_gridItem.png");
pSprite->setAnchorPoint(CCPointZero);
pSprite->setPosition(CCPointZero);
pSprite->setScale(1);
pCell->addChild(pSprite);
//2.prizePicture
pCell->removeChildByTag(122);
pCell->addChild(prizePicture);
//3.coinName
CCLabelTTF *pLabeName = CCLabelTTF::create(this->coinName[idx].c_str(), "Arial", 28);
pLabeName->setPosition(ccp(20, 10));
pLabeName->setColor(ccc3(88, 88, 88));
pLabeName->setAnchorPoint(CCPointZero);
pLabeName->setTag(123);
pCell->addChild(pLabeName);
//4.prizePrice
char priceChar[11];
sprintf(priceChar, "%d",this->coinListPrice[idx]);
string t1 = "¥";
t1 = t1 + priceChar;
CCLabelTTF *pLabelPrice = CCLabelTTF::create(t1.c_str(), "Arial", 28);
pLabelPrice->setPosition(ccp(tableCellSize.width*0.37, tableCellSize.height*0.8));
pLabelPrice->setAnchorPoint(CCPointZero);
pLabelPrice->setTag(124);
pLabelPrice->setColor(ccc3(250, 131, 26));
pCell->addChild(pLabelPrice);
//5.购买
CCMenuItemImage *itemImage = CCMenuItemImage::create("ZF_Shoot_button_coinList_buy1.png", "ZF_Shoot_button_coinList_buy2.png", this, menu_selector(MallMarkets::menuItemCall2));
if (itemImage->getTag() == -1) {
itemImage->setTag(idx);
}
itemImage->setPosition(ccp(tableCellSize.width*0.4, tableCellSize.height*0.42));
CCMenu *menu = CCMenu::create(itemImage,NULL);
menu->setPosition(CCPointZero);
pCell->addChild(menu, 1);
}else{
pCell->removeChildByTag(122);
pCell->addChild(prizePicture);
CCLabelTTF *pLabeName = (CCLabelTTF*)pCell->getChildByTag(123);
pLabeName->setString(this->coinName[idx].c_str());
char priceChar[11];
sprintf(priceChar, "%d",this->coinListPrice[idx]);
string t1 = "¥";
//string t2 = "元人民币";
//t1 = t1 + priceChar + t2;
t1 = t1 + priceChar;
CCLabelTTF *pLabelPrice = (CCLabelTTF*)pCell->getChildByTag(124);
pLabelPrice->setString(t1.c_str());
}
return pCell;
}