本文整理汇总了C++中TableViewCell类的典型用法代码示例。如果您正苦于以下问题:C++ TableViewCell类的具体用法?C++ TableViewCell怎么用?C++ TableViewCell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TableViewCell类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: new
TableViewCell* TableViewTest::tableCellAtIndex(TableView *table, ssize_t idx)
{
auto string = String::createWithFormat("%ld", idx);
TableViewCell *cell = table->dequeueCell();
if (!cell) {
cell = new (std::nothrow) CustomTableViewCell();
cell->autorelease();
auto sprite = Sprite::create("Images/Icon.png");
sprite->setAnchorPoint(Vec2::ZERO);
sprite->setPosition(Vec2(0, 0));
cell->addChild(sprite);
auto label = Label::createWithSystemFont(string->getCString(), "Helvetica", 20.0);
label->setPosition(Vec2::ZERO);
label->setAnchorPoint(Vec2::ZERO);
label->setTag(123);
cell->addChild(label);
}
else
{
auto label = (Label*)cell->getChildByTag(123);
label->setString(string->getCString());
}
return cell;
}
开发者ID:AomXD,项目名称:workspace,代码行数:27,代码来源:TableViewTestScene.cpp
示例2: removeCellAtIndex
void TableView::removeCellAtIndex(ssize_t idx)
{
if (idx == CC_INVALID_INDEX)
{
return;
}
long uCountOfItems = _dataSource->numberOfCellsInTableView(this);
if (0 == uCountOfItems || idx > uCountOfItems-1)
{
return;
}
ssize_t newIdx = 0;
TableViewCell* cell = this->cellAtIndex(idx);
if (!cell)
{
return;
}
newIdx = _cellsUsed.getIndex(cell);
//remove first
this->_moveCellOutOfSight(cell);
_indices->erase(idx);
this->_updateCellPositions();
for (ssize_t i = _cellsUsed.size()-1; i > newIdx; i--)
{
cell = _cellsUsed.at(i);
this->_setIndexForCell(cell->getIdx()-1, cell);
}
}
开发者ID:TheWindShan,项目名称:HYFish,代码行数:35,代码来源:CCTableView.cpp
示例3: CustomTableViewCell
TableViewCell* TableViewTestLayer::tableCellAtIndex(TableView *table, unsigned int idx)
{
String *string = String::createWithFormat("%d", idx);
TableViewCell *cell = table->dequeueCell();
if (!cell) {
cell = new CustomTableViewCell();
cell->autorelease();
Sprite *sprite = Sprite::create("Images/Icon.png");
sprite->setAnchorPoint(Point::ZERO);
sprite->setPosition(Point(0, 0));
cell->addChild(sprite);
LabelTTF *label = LabelTTF::create(string->getCString(), "Helvetica", 20.0);
label->setPosition(Point::ZERO);
label->setAnchorPoint(Point::ZERO);
label->setTag(123);
cell->addChild(label);
}
else
{
LabelTTF *label = (LabelTTF*)cell->getChildByTag(123);
label->setString(string->getCString());
}
return cell;
}
开发者ID:aberaud,项目名称:cocos2d-x,代码行数:27,代码来源:TableViewTestScene.cpp
示例4: MAX
void TableView::scrollViewDidScroll(ScrollView* view)
{
long countOfItems = _dataSource->numberOfCellsInTableView(this);
if (0 == countOfItems)
{
return;
}
if (_isUsedCellsDirty)
{
_isUsedCellsDirty = false;
std::sort(_cellsUsed.begin(), _cellsUsed.end(), [](TableViewCell *a, TableViewCell *b) -> bool{
return a->getIdx() < b->getIdx();
});
}
if(_tableViewDelegate != nullptr) {
_tableViewDelegate->scrollViewDidScroll(this);
}
ssize_t startIdx = 0, endIdx = 0, idx = 0, maxIdx = 0;
Vec2 offset = this->getContentOffset() * -1;
maxIdx = MAX(countOfItems-1, 0);
if (_vordering == VerticalFillOrder::TOP_DOWN)
{
offset.y = offset.y + _viewSize.height/this->getContainer()->getScaleY();
}
startIdx = this->_indexFromOffset(offset);
if (startIdx == CC_INVALID_INDEX)
{
startIdx = countOfItems - 1;
}
if (_vordering == VerticalFillOrder::TOP_DOWN)
{
offset.y -= _viewSize.height/this->getContainer()->getScaleY();
}
else
{
offset.y += _viewSize.height/this->getContainer()->getScaleY();
}
offset.x += _viewSize.width/this->getContainer()->getScaleX();
endIdx = this->_indexFromOffset(offset);
if (endIdx == CC_INVALID_INDEX)
{
endIdx = countOfItems - 1;
}
#if 0 // For Testing.
Ref* pObj;
int i = 0;
CCARRAY_FOREACH(_cellsUsed, pObj)
{
TableViewCell* pCell = static_cast<TableViewCell*>(pObj);
log("cells Used index %d, value = %d", i, pCell->getIdx());
i++;
}
开发者ID:TheWindShan,项目名称:HYFish,代码行数:59,代码来源:CCTableView.cpp
示例5: GetHeight
unsigned int TableView::GetHeight() const noexcept {
unsigned int nCells = m_pTableViewDataSource->NumCells(this);
if (nCells == 0) {
return 0;
}
TableViewCell* pTableViewCell = m_pTableViewDataSource->CellAtIndex(0, this);
return pTableViewCell->GetHeight() *
((nCells - 1) / m_pTableViewDataSource->ColsPerPage(this) + 1);
}
开发者ID:CattyPig,项目名称:CaptainTsubasa,代码行数:10,代码来源:CPTableView.cpp
示例6: log
TableViewCell* SelectMissionScene::tableCellAtIndex(TableView *table, ssize_t idx)
{
log("%d:geted!", idx);
GameManager *manager = GameManager::getInstance();
MissionInfoItem *info = MissionInfoItem::create(manager->getMissionStatus()[idx]);
TableViewCell *cell = table->dequeueCell();
if(!cell)
{
cell = TableViewCell::create(); //or cell = new TTableViewCell(); cell->autorelease()
}
else
{
MissionInfoItem *tmp = static_cast<MissionInfoItem *>(cell->getChildByTag(100));
tmp->removeFromParent();
}
info->setAnchorPoint(Vec2::ZERO);
info->setPosition(Vec2::ZERO);
info->setTag(100);
cell->addChild(info);
#ifdef TEST
/************ Test TableView ******************/
auto index_text = __String::createWithFormat("%ld",idx + 1);
if(!cell)
{
Label *label = Label::create(index_text->getCString(), "Marker Felt.ttf", 18);
label->setPosition( 80, 50 );
label->setTag(150);
cell = TableViewCell::create();
Sprite *sprite = Sprite::create("lock.png");
sprite->setPosition(270, 50);
sprite->setTag(100);
cell->addChild(label );
cell->addChild(sprite);
}
else
{
Label *label = static_cast<Label *>(cell->getChildByTag(150));
label->setString(index_text->getCString());
}
#endif // TEST
return cell;
}
开发者ID:ZeroYang,项目名称:huarongdao,代码行数:53,代码来源:SelectMissionScene.cpp
示例7: TableViewCell
//生成列表每一项的内容
TableViewCell* RankScene::tableCellAtIndex(TableView *table, ssize_t idx)
{
Size mysize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
//读取数据
string str = opt + "_" + Global::shareGlobal()->iToS(idx + 1, 0);
TableViewCell* cell = table->cellAtIndex(idx);
if (!cell)
{
cell = new TableViewCell();
cell->autorelease();
Sprite *item = Sprite::create("tb.png");
item->setPosition(Vec2(origin.x + 180, 15));
cell->addChild(item);
string data = CCUserDefault::sharedUserDefault()->getStringForKey(str.c_str(), "");
//cocos2d::CCMessageBox(t.c_str(),num.c_str());
//return cell;
if (data != "")
{
string t = "";
string num = "";
string score = "";
int i = 0;
while (data[i] != ' ') t += data[i++]; i++; //时间
while (data[i] != ' ') num += data[i++]; i++; //步数
while (i < (int)data.length()) score += data[i++]; //分数
Label *item1 = Label::createWithTTF(Global::shareGlobal()->iToS(idx + 1, 0).c_str(), "fonts/arial.ttf", 18);
Label *item2 = Label::createWithTTF(t.c_str(), "fonts/arial.ttf", 18);
Label *item3 = Label::createWithTTF(num.c_str(), "fonts/arial.ttf", 18);
Label *item4 = Label::createWithTTF(score.c_str(), "fonts/arial.ttf", 18);
item1->setPosition(Vec2(origin.x + 30, 15));
item2->setPosition(Vec2(origin.x + 120, 15));
item3->setPosition(Vec2(origin.x + 210, 15));
item4->setPosition(Vec2(origin.x + 300, 15));
cell->addChild(item1);
cell->addChild(item2);
cell->addChild(item3);
cell->addChild(item4);
}
}
return cell;
}
开发者ID:PhamDinhTri,项目名称:Cocos_Sudoku,代码行数:53,代码来源:Rank.cpp
示例8: TableViewCell
TableViewCell* GameChallengeMap::tableCellAtIndex(TableView* table,ssize_t idx)
{
std::string id = StringUtils::format("%d", idx+1);
TableViewCell *cell = table->dequeueCell();
if (1) {
cell = new TableViewCell();
cell->autorelease();
Sprite* bg = Sprite::create(RESOURCE("map_002.png"));
if (idx%2) {
bg->setTexture(RESOURCE("map_001.png"));
}
bg->setFlippedX(fileMap);
bg->setAnchorPoint(Point(0, 0));
bg->setTextureRect(Rect(0,0,window_size.width,window_size.height));
cell->addChild(bg);
// ID部分
auto *label = Label::createWithSystemFont(id.c_str(), "Arial", 20);
label->setAnchorPoint(Point(0, 0));
label->setPosition(Point(50, 0));
label->setColor(Color3B(0,0,0));
cell->addChild(label);
if (idx>=(12-ci_NormalMissionNum/10)) //如果130关,就是13,但必须是10的整数倍
{
int missionId=120-idx*10; //本单元最大关卡ID
for (int i=0;i<10;++i)
{
GameChallengeMission* mission = GameChallengeMission::create();
mission->setTag(missionId);
mission->setAnchorPoint(Vec2::ZERO);
//取得关卡ID对应的坐标
Vec2 temp=GameUIData::getInstance()->getNormalMissionPos(missionId);
mission->setPosition(temp);
cell->addChild(mission);
mission->setMissionPorperty(missionId);
mission->missionShow(missionId);
--missionId;
}
}
}
return cell;
}
开发者ID:SIM0NL1,项目名称:DND,代码行数:51,代码来源:GameChallengeMap.cpp
示例9:
TableViewCell *TableView::dequeueCell()
{
TableViewCell *cell;
if (_cellsFreed.empty()) {
cell = nullptr;
} else {
cell = _cellsFreed.at(0);
cell->retain();
_cellsFreed.erase(0);
cell->autorelease();
}
return cell;
}
开发者ID:TheWindShan,项目名称:HYFish,代码行数:14,代码来源:CCTableView.cpp
示例10: tableCellAtIndex
/*
TableViewCell* cell = table->dequeueCell();
if(NULL == cell){
cell = TableViewCell::create();
for(int i=0; i<3; i++){
Label* lbl = Label::create();
lbl->setTextColor(Color4B::WHITE);
lbl->setSystemFontSize(40.00);
lbl->setAnchorPoint(Point(0, 0));
lbl->setHorizontalAlignment(TextHAlignment::CENTER);
lbl->setTag(100+i);
float x = lbl->getPositionX();
lbl->setPositionX(x+i*m_width/3);
cell->addChild(lbl);
}
}
((Label*)cell->getChildByTag(100))->setString(StringUtils::format("Label %ld-1", idx));
((Label*)cell->getChildByTag(101))->setString(StringUtils::format("Label %ld-2", idx));
((Label*)cell->getChildByTag(102))->setString(StringUtils::format("Label %ld-3", idx));
return cell;
*/
TableViewCell* AlbumLayer::tableCellAtIndex(TableView *table, ssize_t idx){
TableViewCell* cell = table->dequeueCell();
Sprite* s = NULL;
if(NULL == cell){
cell = TableViewCell::create();
cell->removeAllChildren();
for(int i=0; i<3; i++){
}
}else{
}
return cell;
}
开发者ID:xrlw111201,项目名称:ayh,代码行数:39,代码来源:AlbumLayer.cpp
示例11: TableViewCell
TableViewCell* GCScoreTable::tableCellAtIndex(cocos2d::extension::TableView *table, ssize_t idx)
{
TableViewCell* cell = table->dequeueCell();
if(!cell)
{
cell = new TableViewCell();
cell->autorelease();
}
cell->removeAllChildrenWithCleanup(true);
log("idx = %zd",idx);
Ref* data = _result->getData().at(idx);
Layer* item = this->createCell(data, idx);
cell->addChild(item);
return cell;
}
开发者ID:eugeneus,项目名称:indi-a,代码行数:17,代码来源:GCScoreTable.cpp
示例12: CCARRAY_FOREACH
void TableView::reloadData()
{
_oldDirection = Direction::NONE;
Object* pObj = NULL;
CCARRAY_FOREACH(_cellsUsed, pObj)
{
TableViewCell* cell = static_cast<TableViewCell*>(pObj);
if(_tableViewDelegate != NULL) {
_tableViewDelegate->tableCellWillRecycle(this, cell);
}
_cellsFreed->addObject(cell);
cell->reset();
if (cell->getParent() == this->getContainer())
{
this->getContainer()->removeChild(cell, true);
}
}
开发者ID:Ratel13,项目名称:HXGame,代码行数:19,代码来源:CCTableView.cpp
示例13: TableViewCell
TableViewCell* SceneRule::tableCellAtIndex(TableView *table, ssize_t idx)
{
TableViewCell *cell = table->dequeueCell();
if (cell) {
cell->removeAllChildrenWithCleanup(true);
}
cell = new TableViewCell();
cell->autorelease();
QAKind *gk = listQAKind.at(idx);
std::string title = gk->getTitle();
Vector<MenuItem *> itemArray;
auto item = GameTool::addBtn2(&itemArray, title, 30, Point(cellWidth/2, cellHeight/2), ANCHOR_CENTER_CENTER, CC_CALLBACK_1(SceneRule::callbackBtn, this));
item->setTag((int)idx);
KUtil::addMenu(cell, &itemArray, 30);
return cell;
}
开发者ID:keltonxian,项目名称:BigTwo,代码行数:20,代码来源:SceneRule.cpp
示例14: TableViewCell
// セルの内容を設定
TableViewCell* Overview::tableCellAtIndex(TableView *table, ssize_t idx){
std::string id = StringUtils::format("%zd", idx);
std::string text = StringUtils::format("Line %zd", idx);
TableViewCell *cell = table->dequeueCell();
cell = new TableViewCell();
cell->autorelease();
// セルの背景
auto background_color = Color3B(255,255,255);
if (idx%2) {
background_color = Color3B(200,200,200);
}
Sprite* bg = Sprite::create();
bg->setAnchorPoint(Point(0, 0));
bg->setTextureRect(Rect(0, 0, window_size.width, 24));
bg->setColor(background_color);
bg->setTag(100);
cell->addChild(bg, 0);
// ボーダーライン
Sprite* line = Sprite::create();
line->setAnchorPoint(Point(0, 0));
line->setTextureRect(Rect(0, 0, window_size.width, 1));
line->setColor(Color3B(0,0,0));
cell->addChild(line, 1);
//Story取得
auto story = story_list.begin() + idx;
// ID部分
auto *label_1 = LabelTTF::create(story.operator*()->getTitle().c_str(), "Arial", 16);
label_1->setAnchorPoint(Point(0, 0));
label_1->setPosition(Point(10, 0));
label_1->setColor(Color3B(0,0,0));
cell->addChild(label_1, 1);
return cell;
}
开发者ID:raharu0425,项目名称:Abyss,代码行数:42,代码来源:Overview.cpp
示例15: tableCellAtIndex
TableViewCell* HelloWorld::tableCellAtIndex(cocos2d::extension::TableView *table, ssize_t idx){
TableViewCell *cell = table->dequeueCell();
LabelTTF *label;
if(cell == NULL){
cell = TableViewCell::create();
label = LabelTTF::create();
label->setTag(2);
cell->addChild(label);
label->setFontSize(30);
label->setAnchorPoint(Point(0,0));
}
else {
label = (LabelTTF*)cell->getChildByTag(2);
}
label->setString(StringUtils::format("Label %ld",idx));
return cell;
};
开发者ID:rsrzrcj,项目名称:Cocos2dxLessons20150910,代码行数:21,代码来源:HelloWorldScene.cpp
示例16: TableViewCell
TableViewCell* SkillTableView::tableCellAtIndex(TableView *table, ssize_t idx)
{
CCString* str = CCString::createWithFormat("ui/skill/skill_%d.png",2001 + (int)idx);
TableViewCell* cell = table->dequeueCell();
if (!cell)
{
cell = new TableViewCell();
cell->autorelease();
Scale9Sprite* bg = Scale9Sprite::create("ui/cell.png");
bg->setAnchorPoint(Point::ZERO);
bg->setPosition(Point::ZERO);
bg->setPreferredSize(Size(420, 80));
cell->addChild(bg);
Sprite* skill = Sprite::create(str->getCString());
skill->setPosition(Point(50, 40));
cell->addChild(skill, 0, 123);
m_skillVec.push_back(skill);
}
else
{
Sprite* skill = (Sprite*)cell->getChildByTag(123);
Texture2D* texture = Director::getInstance()->getTextureCache()->addImage(str->getCString());
skill->setTexture(texture);
}
cell->setTag(2001+(int)idx);
return cell;
}
开发者ID:gujianhesong,项目名称:GujianDream,代码行数:29,代码来源:SkillTableView.cpp
示例17: TableViewCell
TableViewCell* TaskDialog::tableCellAtIndex(cocos2d::extension::TableView *table, ssize_t idx)
{
TableViewCell *cell = table->dequeueCell();
if (!cell)
{
cell = new TableViewCell();
cell->autorelease();
if (tableViewCellNode)
{
tableViewCellNode->setTag(10);
int h = tableViewCellNode->getContentSize().height;
h = h>tableViewSize.height?h:tableViewSize.height;
tableViewCellNode->setPosition(ccp(0, h));
cell->addChild(tableViewCellNode);
}
}
else
{
int h = tableViewCellNode->getContentSize().height;
h = h>tableViewSize.height?h:tableViewSize.height;
tableViewCellNode->setPosition(ccp(0, h));
}
return cell;
}
开发者ID:lure9999,项目名称:Nodie,代码行数:24,代码来源:TaskDialog.cpp
示例18: new
TableViewCell* MainScene::tableCellAtIndex(TableView *table, ssize_t idx)
{
TableViewCell *cell = cell = new (std::nothrow) CustomTableViewCell();
cell->autorelease();
auto sprite = Sprite::create(menuImages[idx%length]);
sprite->setAnchorPoint(Vec2::ZERO);
sprite->setPosition(Vec2(0, 0));
cell->addChild(sprite);
cell->setContentSize(Size(100,200));
sprite->setContentSize(Size(110,200));
Size cellSize = cell->getContentSize();
auto label = Label::createWithSystemFont(menuTitile[idx%length], "微软雅黑", 16);
Size lableSize = label->getContentSize();
label->setPosition(50, 30);
label->setTag(123);
cell->addChild(label);
return cell;
}
开发者ID:newhope1106,项目名称:cocos2d-x-sample,代码行数:21,代码来源:MainScene.cpp
示例19: CCLOG
cocos2d::extension::TableViewCell* HelpInfoUI::tableCellAtIndex(cocos2d::extension::TableView *table, ssize_t idx)
{
CCLOG("%zd",idx);
cocos2d::Size size = Director::getInstance()->getVisibleSize();
Color3B color = SceneFactory::getInstance()->getSceneColor();
TableViewCell *cell = table->cellAtIndex(idx);
if (!cell) {
cell = TableViewCell::create();
cell->setCascadeColorEnabled(true);
cell->setColor(color);
switch (idx) {
case 0:
{
Label* desc = Label::createWithTTF(CommonUtility::getLocalString("GameDesc"),CommonUtility::getLocalString("CommonFont"), 25, cocos2d::Size(550, 300), TextHAlignment::LEFT, TextVAlignment::TOP);
desc->setPosition(Vec2(size.width*0.62f, size.height*0.5f));
cell->addChild(desc);
Sprite *conwaySprite = Sprite::create("Conway.png");
conwaySprite->setPosition(Vec2(size.width*0.2f, size.height*0.5f));
cell->addChild(conwaySprite);
}
break;
case 1:
{
Label* gameRule = Label::createWithTTF(CommonUtility::getLocalString("GameRule"),CommonUtility::getLocalString("CommonFont"), 22, cocos2d::Size(850, 300), TextHAlignment::LEFT, TextVAlignment::TOP);
gameRule->setPosition(Vec2(size.width*0.5f, size.height*0.62f));
cell->addChild(gameRule);
Label* detail = Label::createWithTTF(CommonUtility::getLocalString("GameRuleDetail"),CommonUtility::getLocalString("CommonFont"), 22, cocos2d::Size(660, 300), TextHAlignment::LEFT, TextVAlignment::TOP);
detail->setPosition(Vec2(size.width*0.6f, size.height*0.435f));
cell->addChild(detail);
Label* ruleEnd = Label::createWithTTF(CommonUtility::getLocalString("GameRuleEnd"),CommonUtility::getLocalString("CommonFont"), 22, cocos2d::Size(850, 300), TextHAlignment::LEFT, TextVAlignment::TOP);
ruleEnd->setPosition(Vec2(size.width*0.5f, size.height*0.15f));
cell->addChild(ruleEnd);
Animation *animation = Animation::create();
for (int i = 1; i <= 2; i++)
{
std::string str = String::createWithFormat("sample%d.png",i)->getCString();
animation->addSpriteFrameWithFile(str);
}
animation->setDelayPerUnit(0.5f);
animation->setRestoreOriginalFrame(true);
Animate *action = Animate::create(animation);
Sprite *sampleSprite = Sprite::create();
sampleSprite->setPosition(Vec2(size.width*0.15f, size.height*0.53f));
sampleSprite->setScale(0.3f);
sampleSprite->runAction(RepeatForever::create(action));
cell->addChild(sampleSprite);
}
break;
case 2:
{
Label* patterns = Label::createWithTTF(CommonUtility::getLocalString("Patterns"),CommonUtility::getLocalString("CommonFont"), 22, cocos2d::Size(850, 300), TextHAlignment::LEFT, TextVAlignment::TOP);
patterns->setPosition(Vec2(size.width*0.5f, size.height*0.6f));
cell->addChild(patterns);
Label* stillLifes = Label::createWithTTF(CommonUtility::getLocalString("Stable"),CommonUtility::getLocalString("CommonFont"), 22, cocos2d::Size(850, 300), TextHAlignment::LEFT, TextVAlignment::TOP);
stillLifes->setPosition(Vec2(size.width*0.5f, size.height*0.52f));
cell->addChild(stillLifes);
Label* oscillators = Label::createWithTTF(CommonUtility::getLocalString("Oscillating"),CommonUtility::getLocalString("CommonFont"), 22, cocos2d::Size(850, 300), TextHAlignment::LEFT, TextVAlignment::TOP);
oscillators->setPosition(Vec2(size.width*0.5f, size.height*0.21f));
cell->addChild(oscillators);
Sprite *stilllife1 = Sprite::create("stilllife1.png");
stilllife1->setPosition(Vec2(size.width*0.2f, size.height*0.58f));
stilllife1->setScale(0.3f);
cell->addChild(stilllife1);
Sprite *stilllife2 = Sprite::create("stilllife2.png");
stilllife2->setPosition(Vec2(size.width*0.4f, size.height*0.58f));
stilllife2->setScale(0.3f);
cell->addChild(stilllife2);
Sprite *stilllife3 = Sprite::create("stilllife3.png");
stilllife3->setPosition(Vec2(size.width*0.6f, size.height*0.58f));
stilllife3->setScale(0.3f);
cell->addChild(stilllife3);
Sprite *stilllife4 = Sprite::create("stilllife4.png");
stilllife4->setPosition(Vec2(size.width*0.8f, size.height*0.58f));
stilllife4->setScale(0.3f);
cell->addChild(stilllife4);
Sprite *oscillators1 = Sprite::create("oscillators1.png");
oscillators1->setPosition(Vec2(size.width*0.2f, size.height*0.27f));
oscillators1->setScale(0.3f);
cell->addChild(oscillators1);
Sprite *oscillators2 = Sprite::create("oscillators2.png");
oscillators2->setPosition(Vec2(size.width*0.4f, size.height*0.27f));
oscillators2->setScale(0.3f);
cell->addChild(oscillators2);
Sprite *oscillators3 = Sprite::create("oscillators3.png");
oscillators3->setPosition(Vec2(size.width*0.6f, size.height*0.27f));
//.........这里部分代码省略.........
开发者ID:jacket-code,项目名称:SuperLife,代码行数:101,代码来源:HelpInfoUI.cpp
示例20: tableCellAtIndex
/**
* a cell instance at a given index
*
* @param idx index to search for a cell
* @return cell found at idx
*/
TableViewCell* RTChatList::tableCellAtIndex(TableView *table, ssize_t idx)
{
TableViewCell* cell = table->dequeueCell();
if (!cell) {
cell = TableViewCell::create();
}
if (cell) {
cell->removeAllChildren();
auto n = _sayNodeList.at(idx);
n->removeFromParent();
cell->setContentSize(Size(table->getContentSize().width, Default_Cell_Offset_Height + n->getContentSize().height + Default_Cell_Offset_Height));
#if COCOS2D_DEBUG
if (idx % 2 == 0) {
DbgHelper::colorRect(cell,
Point(cell->getContentSize().width / 2.0, cell->getContentSize().height / 2.0), cell->getContentSize(),
Color4F::RED);
}
else {
DbgHelper::colorRect(cell,
Point(cell->getContentSize().width / 2.0, cell->getContentSize().height / 2.0), cell->getContentSize(),
Color4F::YELLOW);
}
#endif
if (n->getFormType() == RTChatNode::FormType::BORDERED) {
if (n->getOwnType() == RTChatNode::OwnType::SELF) {
n->setPosition(Point(cell->getContentSize().width / 2.0 + Default_Cell_Offset_Width, cell->getContentSize().height / 2.0));
}
else {
n->setPosition(Point(cell->getContentSize().width / 2.0 - Default_Cell_Offset_Width, cell->getContentSize().height / 2.0));
}
}
else {
n->setPosition(Point(cell->getContentSize().width / 2.0, cell->getContentSize().height / 2.0));
}
cell->addChild(n);
}
return cell;
}
开发者ID:net4nt,项目名称:RTChatList,代码行数:52,代码来源:RTChatList.cpp
注:本文中的TableViewCell类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论