本文整理汇总了C++中CCTableViewCell::removeAllChildrenWithCleanup方法的典型用法代码示例。如果您正苦于以下问题:C++ CCTableViewCell::removeAllChildrenWithCleanup方法的具体用法?C++ CCTableViewCell::removeAllChildrenWithCleanup怎么用?C++ CCTableViewCell::removeAllChildrenWithCleanup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCTableViewCell
的用法示例。
在下文中一共展示了CCTableViewCell::removeAllChildrenWithCleanup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tableCellAtIndex
CCTableViewCell* HelloWorld::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
CCLOG("int table cell index:%u",idx);
CCTableViewCell *cell = table->dequeueCell();
if (!cell)
{
cell = new CCTableViewCell();
cell->autorelease();
}
cell->removeAllChildrenWithCleanup(true);
if (menuArray->count() < idx + 1)
{
return NULL;
}
CCString * text = (CCString *)(menuArray->objectAtIndex(idx));
CCLabelTTF * menuText = CCLabelTTF::create(text->getCString(), "", 24);
menuText->setAnchorPoint(ccp(0, 0));
menuText->setPosition(ccp(0, 0));
cell->addChild(menuText);
return cell;
}
示例2: tableCellAtIndex
CCTableViewCell* RPGMapItemsMenuLayer::tableCellAtIndex(CCTableView *tableView, unsigned int idx)
{
CCTableViewCell *cell = tableView->dequeueCell();
if (!cell)
{
cell = new CCTableViewCell();
cell->autorelease();
}
else
cell->removeAllChildrenWithCleanup(true);
float x = 100;
for (int i = 0; i < 4; i++)
{
int index = idx * 4 + i;
if(index >= this->m_itemsList->count())
break;
RPGExistingItems *itemsData = (RPGExistingItems*)this->m_itemsList->objectAtIndex(index);
CCControlButton *itemBtn = CCControlButton::create(CCString::createWithFormat("%s (%i)", itemsData->m_name.c_str(), itemsData->m_total)->getCString(), "Arial", 22);
itemBtn->setPosition(ccp(x, 0));
itemBtn->setTag(itemsData->m_dataId);
itemBtn->addTargetWithActionForControlEvents(this, cccontrol_selector(RPGMapItemsMenuLayer::onButton), CCControlEventTouchUpInside);
cell->addChild(itemBtn);
x += 200;
}
return cell;
}
示例3: tableCellAtIndex
CCTableViewCell* RPGBattleMenu::tableCellAtIndex(CCTableView *tableView, unsigned int idx)
{
CCTableViewCell *cell = tableView->dequeueCell();
if (!cell)
{
cell = new CCTableViewCell();
cell->autorelease();
}
else
cell->removeAllChildrenWithCleanup(true);
if(dynamic_cast<RPGSkillBtnData*>(this->m_tableItems->objectAtIndex(idx)) != NULL)
{
//点击了技能项
RPGSkillBtnData *itemsData = (RPGSkillBtnData*)this->m_tableItems->objectAtIndex(idx);
CCControlButton *itemBtn = CCControlButton::create(CCString::createWithFormat("%s (%i)", itemsData->m_name.c_str(), itemsData->m_MP)->getCString(), "Arial", 22);
itemBtn->setPosition(ccp(tableView->getContentSize().width / 2, 0));
itemBtn->setTag(itemsData->m_dataId);
itemBtn->addTargetWithActionForControlEvents(this, cccontrol_selector(RPGBattleMenu::onButton), CCControlEventTouchUpInside);
cell->addChild(itemBtn);
}
else if(dynamic_cast<RPGExistingItems*>(this->m_tableItems->objectAtIndex(idx)) != NULL)
{
//点击了道具项
RPGExistingItems *itemsData = (RPGExistingItems*)this->m_tableItems->objectAtIndex(idx);
CCControlButton *itemBtn = CCControlButton::create(CCString::createWithFormat("%s (%i)", itemsData->m_name.c_str(), itemsData->m_total)->getCString(), "Arial", 22);
itemBtn->setPosition(ccp(tableView->getContentSize().width / 2, 0));
itemBtn->setTag(itemsData->m_dataId);
itemBtn->addTargetWithActionForControlEvents(this, cccontrol_selector(RPGBattleMenu::onButton), CCControlEventTouchUpInside);
cell->addChild(itemBtn);
}
return cell;
}