本文整理汇总了C++中CCTableViewCell::getChildByTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CCTableViewCell::getChildByTag方法的具体用法?C++ CCTableViewCell::getChildByTag怎么用?C++ CCTableViewCell::getChildByTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCTableViewCell
的用法示例。
在下文中一共展示了CCTableViewCell::getChildByTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CCTableViewCell
CCTableViewCell* S131More::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
CCTableViewCell *pCell = table->dequeueCell();
if (!pCell)
{
pCell = new CCTableViewCell();
pCell->autorelease();
CCSprite *pSprite1 = CCSprite::create("S13PRightPoint.png");
pSprite1->setPosition(ccp(0,90));
pSprite1->setTag(1010);
pCell->addChild(pSprite1);
string aStr = rightBigTitle[PersonalApi::convertIntToString(idx+1)]+" "+rightTime[PersonalApi::convertIntToString(idx+1)];
const char * labelStr = aStr.c_str();//rightBigTitle[PersonalApi::convertIntToString(idx+1)].c_str();
float titleFontSize = 20;
CCSize titleDetailSize = CCSizeMake(500, 30);
CCLabelTTF *pLabel = CCLabelTTF::create(labelStr, s1FontName_macro, titleFontSize, titleDetailSize, kCCTextAlignmentLeft, kCCVerticalTextAlignmentTop);
pLabel->setTag(234);
pLabel->setPosition(ccp(280,180));
pLabel->setColor(ccBLACK);
pCell->addChild(pLabel);
const char * labelStr2 = rightDetailTitle[PersonalApi::convertIntToString(idx+1)].c_str();
float titleFontSize2 = 20;
CCSize titleDetailSize2 = CCSizeMake(500, 30);
CCLabelTTF *pLabel2 = CCLabelTTF::create(labelStr2, s1FontName_macro, titleFontSize2, titleDetailSize2, kCCTextAlignmentLeft, kCCVerticalTextAlignmentTop);
pSprite1->setAnchorPoint(ccp(0.0,1.0));
pLabel2->setTag(567);
pLabel2->setPosition(ccp(280,130));
pLabel2->setColor(ccBLACK);
pCell->addChild(pLabel2);
CCSprite *pSprite2 = CCSprite::create("s131RightWordBottom.png");
pSprite2->setAnchorPoint(CCPointZero);
pSprite2->setTag(999);
pSprite2->setPosition(ccp(0,0));
pCell->addChild(pSprite2);
}
else
{
CCLabelTTF *pLabel = (CCLabelTTF*)pCell->getChildByTag(234);
pLabel->setString((rightBigTitle[PersonalApi::convertIntToString(idx)]+" "+rightTime[PersonalApi::convertIntToString(idx)]).c_str());
CCLabelTTF *pLabel2 = (CCLabelTTF*)pCell->getChildByTag(567);
pLabel2->setString(rightDetailTitle[PersonalApi::convertIntToString(idx)].c_str());
}
return pCell;
}
示例2: 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;
}
示例3: CCTableViewCell
CCTableViewCell* S22PicDetail::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
CCTableViewCell *pCell = table->dequeueCell();
if (!pCell)
{
pCell = new CCTableViewCell();
pCell->autorelease();
string picName = "S2"+ PersonalApi::convertIntToString(AppDelegate::S2SelectedScene)+ PersonalApi::convertIntToString(AppDelegate::S2LeftSelected)+"Display"+PersonalApi::convertIntToString(idx+1)+".png";
string picNameStr=PersonalApi::getRealImageName(picName.c_str(),"S2BigPic.png").c_str();
CCSprite *pSprite = CCSprite::create(picNameStr.c_str());
pSprite->setAnchorPoint(CCPointZero);
pSprite->setTag(123);
float pSpriteScale = tableViewBackGroundSp->getContentSize().height/pSprite->getContentSize().height;
pSprite->setScale(pSpriteScale);
pSprite->setPosition(ccp(0,pSprite->getPosition().y-pSprite->getContentSize().height*pSpriteScale/2));
pCell->addChild(pSprite);
}
else
{
CCSprite *pSprite = (CCSprite*)pCell->getChildByTag(123);
string picName = "S2"+ PersonalApi::convertIntToString(AppDelegate::S2SelectedScene)+ PersonalApi::convertIntToString(AppDelegate::S2LeftSelected)+"Display"+PersonalApi::convertIntToString(idx+1)+".png";
string picNameStr=PersonalApi::getRealImageName(picName.c_str(),"S2BigPic.png").c_str();
pSprite->setTexture(CCTextureCache::sharedTextureCache()->addImage(picNameStr.c_str()));
}
return pCell;
}
示例4: disableAllTouchEnd
void MainLayerZhuangBeiBaseBody::disableAllTouchEnd()
{
mTableView->setTouchEnabled(true);
int cellNum = numberOfCellsInTableView(mTableView);
for (int i=0; i<cellNum; i++)
{
CCTableViewCell* cell = mTableView->cellAtIndex(i);
if (cell)
{
CCNode* bg = cell->getChildByTag(TAG_EquipBaseBody_TABLE_ITEM);
if (bg)
{
CCMenu* menu = (CCMenu*)bg->getChildByTag(TAG_BaseBody_MENU);
if (menu)
{
menu->setEnabled(true);
}
}
}
}
CCPoint beg = mTableView->getContentOffset();
if (mOffset.y < beg.y) mOffset.y = beg.y;
if (mOffset.y > tableCellSizeForIndex(mTableView,0).height*3) mOffset.y = tableCellSizeForIndex(mTableView,0).height*3;
mTableView->setContentOffset(mOffset);
}
示例5: tableCellAtIndex
CCTableViewCell* GameUI_MainTitle::tableCellAtIndex(cocos2d::extension::CCTableView *table, unsigned int idx)
{
CCString *string = CCString::createWithFormat("%d", idx);
CCTableViewCell *cell = table->dequeueCell();
if (!cell)
{
cell = new CCTableViewCell();
cell->autorelease();
CCSprite *sprite = CCSprite::create("Icon.png");
sprite->setAnchorPoint(CCPointZero);
sprite->setPosition(ccp(0, 0));
cell->addChild(sprite);
CCLabelTTF *label = CCLabelTTF::create(string->getCString(), "Helvetica", 20.0);
label->setPosition(CCPointZero);
label->setAnchorPoint(CCPointZero);
label->setTag(123);
cell->addChild(label);
}
else
{
CCLabelTTF *label = (CCLabelTTF*)cell->getChildByTag(123);
label->setString(string->getCString());
}
return cell;
}
示例6: disableAllTouchBegin
void MainLayerHerosBaseBody::disableAllTouchBegin()
{
mTableView->setTouchEnabled(false);
int cellNum = numberOfCellsInTableView(mTableView);
for (int i=0;i<cellNum;i++)
{
CCTableViewCell* cell = mTableView->cellAtIndex(i);
if (cell)
{
CCNode* bg = cell->getChildByTag(TAG_BaseBody_TABLE_ITEM);
if (bg)
{
CCMenu* menu = (CCMenu*)bg->getChildByTag(TAG_BaseBody_TABLE_HERO_IMG);
if (menu)
{
menu->setEnabled(false);
}
menu = (CCMenu*)bg->getChildByTag(TAG_Menu);
if(menu)
{
menu->setEnabled(false);
}
}
}
}
}
示例7: tableCellAtIndex
CCTableViewCell* DebugTestScene::tableCellAtIndex( CCTableView* in_pTable, unsigned int in_idx )
{
CELL_DATA* pCellData = &s_aSelectSceneList[in_idx];
CCString* pText = CCString::create(pCellData->pText);
CCTableViewCell* pCell = in_pTable->dequeueCell();
if( pCell == NULL )
{
pCell = new CCTableViewCell();
pCell->autorelease();
CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
// ラベル追加
{
CCLabelTTF* pLabel =
CCLabelTTF::create( pText->getCString(), "Helvetica", MultiResolution::shared()->getFontSize(s_fontSize_.width) );
pLabel->setPosition(ccp(origin.x, 0));
pLabel->setAnchorPoint(CCPointZero);
pLabel->setTag(100);
pCell->addChild(pLabel);
}
}
else
{
CCLabelTTF* pLabel = (CCLabelTTF*)pCell->getChildByTag(100);
pLabel->setString(pText->getCString());
}
return pCell;
}
示例8: tableCellAtIndex
//reload가 호출 되거나, 스크롤이 움직여 안보이는 셀이 보여질 때 호출된다.
CCTableViewCell* MenuScene::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
//테이블이 사용 중인 셀이 있다면 재활용한다. 테이블 뷰는 똑같은 모양에 데이터만 다른 경우가 많다. 그래서 하나의 셀을 재사용하고 데이터만 바꿔준다.
CCTableViewCell *cell = table->dequeueCell();
//datalist에서 데이터를 가져온다. 여기서는 CCString을 했지만, CCObject를 상속받은 커스텀 클래스를 만들어서 여러 정보를 담을 수 있을 것이다.
CCString* string = (CCString*) datalist->objectAtIndex(idx);
if (!cell) {
//커스텀 셀을 이용했는데, 이는 커스텀 셀 부분의 draw 함수를 오버로딩하여 여러가지 효과를 줄 수 있기 때문이다. 이 예제에서는 아무런 추가 내용이 없지만, 이부분을 이용하여 3D리스트 뷰나, 크기가 바뀌는 리스트 뷰 같은 조금 더 다이나믹한 리스트뷰를 만들 수 있을 것 같다.
cell = new TableViewCell();
cell->autorelease();
CCLabelTTF *label = CCLabelTTF::create(string->getCString(), "Helvetica", 20.0);
label->setPosition(CCPointZero);
label->setAnchorPoint(CCPointZero);
label->setTag(123);
cell->addChild(label);
}
else
{
CCLabelTTF *label = (CCLabelTTF*)cell->getChildByTag(123);
label->setString(string->getCString());
}
return cell;
}
示例9: tableCellAtIndex
CCTableViewCell* ListViewLayer::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
//CCString *pString = (CCString *)aArray->objectAtIndex(idx);
const char * str = aVect[idx].c_str();
CCLOG("%s\n/////////",str);
CCTableViewCell *pCell = table->dequeueCell();
if (!pCell) {
pCell = new CCTableViewCell();
pCell->autorelease();
/* CCSprite *pSprite = CCSprite::create("pBackground.png");
//pSprite->setColor(ccBLUE);
pSprite->setAnchorPoint(CCPointZero);
pSprite->setPosition(CCPointZero);
pCell->addChild(pSprite);
*/
CCLabelTTF *pLabel = CCLabelTTF::create(str, "Arial", 20.0,CCSizeMake(table->getContentSize().width, 0), kCCTextAlignmentLeft);
pLabel->setPosition(CCPointZero);
pLabel->setAnchorPoint(CCPointZero);
pLabel->setTag(123);
pLabel->setColor(ccBLACK);
//pLabel->setContentSize(CCSizeMake(table->getContentSize().width-60, 120));
pCell->addChild(pLabel);
}
else
{
CCLabelTTF *pLabel = (CCLabelTTF*)pCell->getChildByTag(123);
pLabel->setString(str);
}
return pCell;
}
示例10: select
void GongJiang_EquipSelect::select()
{
CCTableViewCell* lastCell = mTableView->cellAtIndex(0);
if (lastCell)
{
BaseSprite* bg = (BaseSprite*)lastCell->getChildByTag(TAG_EquipBaseBody_TABLE_ITEM);
bool isFirstIn = false;
// 先不管是否点击了图片
if(GameGuideManager::getManager()->isGuideNow(GameGuideManager::GID_GongJiang_QiangHua))
{
//GameGuideManager::getManager()->setOneGuideStart(GameGuideManager::GID_GongJiang_SelectZhuangBei);
//GameGuideManager::getManager()->setOneGuideEnd(GameGuideManager::GID_GongJiang_SelectZhuangBei);
if (bg)
{
CCPoint pos = bg->getParent()->convertToWorldSpace(bg->getPosition());
GuideLayerBase *guideLayer1 = new GuideLayer_SimpleLayer;
guideLayer1->init(bg->getContentSize(), ccp(pos.x,pos.y + bg->getContentSize().height / 2)
, LFStrings::getValue("qiangxuanzezhuangbei"), NULL, false);
//((GuideLayer_SimpleLayer*)guideLayer1)->setCallBack(this,SEL_CallFunc(&JiuGongGeLayer::GuiDeLayerCallBack));
CCDirector::sharedDirector()->getRunningScene()->addChild(guideLayer1, 128);
}
}
}
}
示例11: tableCellAtIndex
CCTableViewCell* DataSourceOfHour::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
CCString *string;
if (idx >= 2 && idx <= 25)
string = CCString::createWithFormat("%0.2d", idx-2);
else
string = CCString::createWithFormat("");
CCTableViewCell *cell = table->dequeueCell();
if (!cell) {
cell = new CustomTableViewCell();
cell->autorelease();
CCLabelTTF *label = CCLabelTTF::create(string->getCString(), "Helvetica", 25.0);
label->setColor(ccBLACK);
label->setPosition(ccp(WIDTH/2, HIGHT/2));
label->setAnchorPoint(ccp(0.5,0.5));
label->setTag(123);
cell->addChild(label);
}
else
{
CCLabelTTF *label = (CCLabelTTF*)cell->getChildByTag(123);
label->setString(string->getCString());
}
return cell;
}
示例12: CustomTableViewCell
CCTableViewCell* S11PrepareRes::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
CCTableViewCell *cell = table->dequeueCell();
if (!cell)
{
cell = new CustomTableViewCell();
cell->autorelease();
if (idx==0)
{
selectIndex=0;
}
CCLabelTTF *label = CCLabelTTF::create("点击输入", "Helvetica", 30.0);
label->setColor(ccBLACK);
label->setPosition(s11Position8_1_macro(label));
label->setAnchorPoint(CCPointZero);
label->setTag(123);
cell->addChild(label,101);
CCSprite *pSprite = CCSprite::create("s11CellDivideLine.png");
pSprite->setAnchorPoint(CCPointZero);
pSprite->setPosition(CCPointZero);
cell->addChild(pSprite,101);
}
else
{
if (selectIndex ==idx)
{
if (activeSprite)
{
activeSprite->removeFromParentAndCleanup(false);
}
activeSprite = CCSprite::create("s11Active Bar.png");
activeSprite->setAnchorPoint(CCPointZero);
activeSprite->setPosition(CCPointZero);
cell->addChild(activeSprite,99);
}
CCLabelTTF *label = (CCLabelTTF*)cell->getChildByTag(123);
CCString *aString = CCString::createWithFormat("%u",idx+1);
std::string aStr = aString->m_sString;
std::map<std::string,std::string>::iterator aIterator = scriptMap.find(aStr);
std::string aStr2;
if (aIterator !=scriptMap.end())
{
aStr2 = aIterator->second;
}
label->setString(aStr2.c_str());
}
return cell;
}
示例13: selectAtIndex
void MainLayerZhuangBeiBody::selectAtIndex(unsigned int index)
{
// 0 是第一个 所有装备
CCTableViewCell* currentCell = tableView->cellAtIndex(index);
CCTableViewCell* lastCell = tableView->cellAtIndex(selectedIndex);
//if (selectedIndex != index)
{
if (lastCell!=NULL)
{
CCMenuItemImage* itemImage = (CCMenuItemImage*)lastCell->getChildByTag(TAG_MENU)->getChildByTag(lastCell->getIdx());
int idx = itemImage->getTag();
itemImage->initWithNormalImage(
itemFiles[idx].c_str()
,itemFiles_select[idx].c_str()
,NULL, this, menu_selector(MainLayerZhuangBeiBody::menuItemClicked));
}
if (currentCell!=NULL)
{
CCMenuItemImage* itemImage = (CCMenuItemImage*)currentCell->getChildByTag(TAG_MENU)->getChildByTag(currentCell->getIdx());
int idx = itemImage->getTag();
itemImage->initWithNormalImage(
itemFiles_select[idx].c_str()
,itemFiles[idx].c_str()
,NULL, this, menu_selector(MainLayerZhuangBeiBody::menuItemClicked));
}
selectedIndex = index;
BaseLayer* content = createContentAtIndex(index);
if (selectedContaint)
{
selectedContaint->removeFromParent();
}
if (content)
{
container->addChild(content);
content->setPosition(ccp(0,0));
}
selectedContaint = content;
}
}
示例14: getListItemByIndex
CCNode* ListViewLayer::getListItemByIndex(int index)
{
CCTableViewCell* lastCell = mTableView->cellAtIndex(index);
if (lastCell)
{
CCNode* wrap = lastCell->getChildByTag(TAG_LIST_CELL_ITEM_WRAP);
return (CCNode*)wrap->getChildren()->objectAtIndex(0);
}
// 已经释放了
return NULL;
}
示例15: tableCellTouched
void GongJiang_EquipSelect::tableCellTouched(CCTableView* table, CCTableViewCell* cell)
{
BaseSprite* bg = (BaseSprite*)cell->getChildByTag(TAG_EquipBaseBody_TABLE_ITEM);
// 先不管是否点击了图片
// 先移除上一个点击的
if (selectedIndex >= 0)
{
CCTableViewCell* lastCell = table->cellAtIndex(selectedIndex);
if (lastCell)
{
lastCell->getChildByTag(TAG_EquipBaseBody_TABLE_ITEM)->removeChildByTag(TAG_BG_MASK_PIC);
}
}
// 再次选自己,代表取消
if (selectedIndex == cell->getIdx())
{
selectedIndex = -1;
}
else
{
selectedIndex = cell->getIdx();
BaseSprite* addEff = BaseSprite::create("mianban_zhuangbei_xiangxi_select.png");
bg->addChild(addEff,10,TAG_BG_MASK_PIC);
addEff->setPosition(ccp(bg->getContentSize().width/2,bg->getContentSize().height/2));
}
if(selectedIndex < 0)
{
mMenuItemMakeSure->setEnabled(false);
}
else
{
mMenuItemMakeSure->setEnabled(true);
}
bool isFirstIn = false;
// 先不管是否点击了图片
if(GameGuideManager::getManager()->isGuideNow(GameGuideManager::GID_GongJiang_QiangHua))
{
//GameGuideManager::getManager()->setOneGuideStart(GameGuideManager::GID_GongJiang_QhHt);
GameGuideManager::getManager()->setOneGuideEnd(GameGuideManager::GID_GongJiang_QiangHua);
if (mMenuItemMakeSure)
{
CCPoint pos = mMenuItemMakeSure->getParent()->convertToWorldSpace(mMenuItemMakeSure->getPosition());
GuideLayerBase *guideLayer1 = new GuideLayer_SimpleLayer;
guideLayer1->init(mMenuItemMakeSure->getContentSize(),pos
, LFStrings::getValue("DingjiQueding"), NULL, false);
//((GuideLayer_SimpleLayer*)guideLayer1)->setCallBack(this,SEL_CallFunc(&JiuGongGeLayer::GuiDeLayerCallBack));
CCDirector::sharedDirector()->getRunningScene()->addChild(guideLayer1, 128);
}
}
}