当前位置: 首页>>代码示例>>C++>>正文


C++ CCTableViewCell类代码示例

本文整理汇总了C++中CCTableViewCell的典型用法代码示例。如果您正苦于以下问题:C++ CCTableViewCell类的具体用法?C++ CCTableViewCell怎么用?C++ CCTableViewCell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CCTableViewCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CCTableViewCell

// Hàm này tạo 1 tableview Row để add vào table view
CCTableViewCell* LayerSMS::tableCellAtIndex(cocos2d::extension::CCTableView *table, unsigned int idx){
    CCTableViewCell *cell = table->dequeueCell();
    StructSMS sms = lstSMS.at(idx);
    if (!cell) {
        cell = new CCTableViewCell();
        cell->autorelease();
        //Time
        CCLabelTTF *labelName = CCLabelTTF::create(sms.content.c_str(), "Helvetica", 16.0);
        labelName->setPosition(ccp(nodeTable->getContentSize().width/2, 20));
		labelName->setAnchorPoint(ccp(0.5, 0.5));
//        labelName->setTag(tag_NameFriend);
        cell->addChild(labelName);
        //Sprite
        CCSprite* line = CCSprite::createWithSpriteFrameName("assest/background_cell.png");
        line->setPosition(ccp(nodeTable->getContentSize().width/2,0));
        line->setScaleX(nodeTable->getContentSize().width/line->getContentSize().width);
        line->setAnchorPoint(ccp(0.5,0));
        cell->addChild(line);
    }
    else
    {
//        CCLabelTTF *label1 = getLabelFromTagID(cell, tag_cellTime);
//        if( label1!=NULL )
//            label1->setString(his.lastUpdateTime.c_str());
//        CCLabelTTF *label2= getLabelFromTagID(cell, tag_cellAmount);
//        if( label2!=NULL )
//            label2->setString(his.amount.c_str());
//        CCLabelTTF *label3 = getLabelFromTagID(cell, tag_cellDetails);
//        if( label3!=NULL )
//            label3->setString(mUtils::getExplainOfTransType(his.transType.c_str()).c_str());
    }
    return cell;
}
开发者ID:mrktj,项目名称:iCasino_v2,代码行数:34,代码来源:LayerSMS.cpp

示例2: CCTableViewCell

CCTableViewCell* MainLayerZhuangBeiBody::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
	CCString *string = CCString::createWithFormat("%d", idx);
	CCTableViewCell *cell = NULL;  //table->dequeueCell();
	if (cell == NULL) 
	{
		cell = new CCTableViewCell();
		cell->autorelease();
	}
	else
	{
		cell->removeAllChildren();
	}
	//
	CCMenuItemImage *itemImage = CCMenuItemImage::create(
		itemFiles[idx].c_str()
		,itemFiles_select[idx].c_str()
		, this, SEL_MenuHandler(&MainLayerZhuangBeiBody::menuItemClicked));
	CCMenu* menu = CCMenu::create();
	cell->addChild(menu, 0, TAG_MENU);
	menu->setPosition(CCPointZero);
	menu->addChild(itemImage, 0, idx);
	itemImage->setPosition(ccp(itemImage->getContentSize().width/2, itemImage->getContentSize().height/2));


	return cell;
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:27,代码来源:MainLayerZhuangBeiBody.cpp

示例3: CCTableViewCell

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;
}
开发者ID:kuronokurujp,项目名称:stg,代码行数:31,代码来源:DebugTestScene.cpp

示例4: CCLOG

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;
}
开发者ID:liuyuyefz,项目名称:GreTest,代码行数:32,代码来源:ListViewLayer.cpp

示例5: CCLOG

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;
}
开发者ID:shazi129,项目名称:MyCocoDemo,代码行数:25,代码来源:HelloWorldScene.cpp

示例6: CCTableViewCell

// Hàm này tạo 1 tableview Row để add vào table view
CCTableViewCell* LayerChangeAvatar::tableCellAtIndex(cocos2d::extension::CCTableView *table, unsigned int idx){
    CCTableViewCell *cell = table->dequeueCell();
    if (!cell) {
        cell = new CCTableViewCell();
        cell->autorelease();
        //Chon
        CCSprite* ready = CCSprite::createWithSpriteFrameName("assest/ratio_disable.png");
        ready->setPosition(ccp(15, 100));
        ready->setAnchorPoint(ccp(0, 0));
        cell->addChild(ready);
        //lable chon
        CCLabelTTF *labelChon = CCLabelTTF::create("Chọn", "Helvetica", 14);
        labelChon->setPosition(ccp(40, 100));
        labelChon->setAnchorPoint(ccp(0, 0));
        cell->addChild(labelChon);
        //avatar
        CCSprite* avatar = CCSprite::createWithSpriteFrameName("assest/icon_default.png");
        avatar->setPosition(ccp(0, 0));
        avatar->setAnchorPoint(ccp(0, 0));
        avatar->cocos2d::CCNode::setScale(93/avatar->getContentSize().width, 93/avatar->getContentSize().height);
        cell->addChild(avatar);    }
    else
    {
        //;;;;
    }
    return cell;
}
开发者ID:mrktj,项目名称:iCasino_v2,代码行数:28,代码来源:LayerChangeAvatar.cpp

示例7: 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;
}
开发者ID:Tingtingyu,项目名称:cocos2dx-scrollbar,代码行数:28,代码来源:MenuScene.cpp

示例8: numberOfCellsInTableView

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);
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:27,代码来源:MainLayerZhuangBeiBaseBody.cpp

示例9: CCTableViewCell

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;
}
开发者ID:bwjdrl2,项目名称:Infinity,代码行数:27,代码来源:GameUI_MainTitle.cpp

示例10: CCTableViewCell

CCTableViewCell* MainLayerHerosBaseBody::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
	CCString *string = CCString::createWithFormat("%d", idx);
	CCTableViewCell *cell = table->dequeueCell();
	if (cell == NULL) 
	{
		cell = new CCTableViewCell();
		cell->autorelease();
	}
	else 
	{
		cell->removeAllChildren();
	}

	cell->addChild(getItemContentByIndex(idx),0,TAG_BaseBody_TABLE_ITEM);
		//CCLog("CCTableViewCell one");
// 	}
// 	else
// 	{
// 		//CCLog("refreshItem one");
// 		CCNode* temp = cell->getChildByTag(TAG_BaseBody_TABLE_ITEM);
// 		refreshItem(temp,idx);
// 	}

	return cell;
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:26,代码来源:MainLayerHerosBaseBody.cpp

示例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;
}
开发者ID:doublsky,项目名称:assiduousme,代码行数:29,代码来源:DataSourceOfHour.cpp

示例12: 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;
}
开发者ID:Ratel13,项目名称:JinRiCompany,代码行数:34,代码来源:S22PicDetail.cpp

示例13: CCTableViewCell

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;
}
开发者ID:ChinaiOS,项目名称:OzgGameRPG,代码行数:32,代码来源:RPGMapItemsMenuLayer.cpp

示例14: 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);
			}
		}
	}

}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:26,代码来源:GongJiang_EquipSelect.cpp

示例15: numberOfCellsInTableView

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);
				}
			}
		}
	}

}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:27,代码来源:MainLayerHerosBaseBody.cpp


注:本文中的CCTableViewCell类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。