本文整理汇总了C++中CATableViewCell::addSubview方法的典型用法代码示例。如果您正苦于以下问题:C++ CATableViewCell::addSubview方法的具体用法?C++ CATableViewCell::addSubview怎么用?C++ CATableViewCell::addSubview使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CATableViewCell
的用法示例。
在下文中一共展示了CATableViewCell::addSubview方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tableCellAtIndex
CATableViewCell* MenuViewController::tableCellAtIndex(CATableView* table, const DSize& cellSize, unsigned int section, unsigned int row)
{
DSize _size = cellSize;
CATableViewCell* cell = table->dequeueReusableCellWithIdentifier("CrossApp");
if (cell == NULL)
{
cell = CATableViewCell::create("CrossApp");
cell->setBackgroundView(NULL);
CALabel* test = CALabel::createWithCenter(DRect(_size.width/2+30,
_size.height/2,
_size.width,
_size.height));
test->setTextAlignment(CATextAlignmentLeft);
test->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
test->setFontSize(_px(32));
test->setColor(CAColor_white);
test->setTag(100);
cell->addSubview(test);
CAImageView* arrow = CAImageView::createWithCenter(DRect(_size.width-64,_size.height/2,64,64));
arrow->setTag(101);
cell->addSubview(arrow);
}
CALabel* test = (CALabel*)cell->getSubviewByTag(100);
test->setText(unicode_to_utf8(menuList[row]));// menuList[row]);
CAImageView* arrow = (CAImageView*)cell->getSubviewByTag(101);
arrow->setImage(CAImage::create("source_material/cell_btn_right.png"));
return cell;
}
示例2: tableCellAtIndex
CATableViewCell* ExtensionsTest::tableCellAtIndex(CATableView* table, const CCSize& cellSize, unsigned int section, unsigned int row)
{
CADipSize _size = cellSize;
Info* p_List = (Info*)personList.getValue(row);
CATableViewCell* cell = table->dequeueReusableCellWithIdentifier("CrossApp");
if (cell == NULL)
{
cell = CATableViewCell::create("CrossApp");
CALabel* p_Name = CALabel::createWithCenter(CADipRect(_size.width*0.1, _size.height*0.5, _size.width*0.2, _size.height));
p_Name->setTag(NAME);
p_Name->setText(p_List->name.c_str());
p_Name->setFontSize(_px(30));
p_Name->setColor(CAColor_blueStyle);
p_Name->setTextAlignment(CATextAlignmentCenter);
p_Name->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
cell->addSubview(p_Name);
CALabel* p_Num = CALabel::createWithCenter(CADipRect(_size.width*0.3, _size.height*0.5, _size.width*0.2, _size.height));
p_Num->setTag(NUM);
p_Num->setText(p_List->num.c_str());
p_Num->setFontSize(_px(30));
p_Num->setColor(CAColor_blueStyle);
p_Num->setTextAlignment(CATextAlignmentCenter);
p_Num->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
cell->addSubview(p_Num);
CALabel* p_Gender = CALabel::createWithCenter(CADipRect(_size.width*0.5, _size.height*0.5, _size.width*0.2, _size.height));
p_Gender->setTag(GENDER);
p_Gender->setText(p_List->gender.c_str());
p_Gender->setFontSize(_px(30));
p_Gender->setColor(CAColor_blueStyle);
p_Gender->setTextAlignment(CATextAlignmentCenter);
p_Gender->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
cell->addSubview(p_Gender);
CALabel* p_Occupation = CALabel::createWithCenter(CADipRect(_size.width*0.8, _size.height*0.5, _size.width*0.3, _size.height));
p_Occupation->setTag(OCCUPATION);
p_Occupation->setText(p_List->occupation.c_str());
p_Occupation->setFontSize(_px(30));
p_Occupation->setColor(CAColor_blueStyle);
p_Occupation->setTextAlignment(CATextAlignmentCenter);
p_Occupation->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
cell->addSubview(p_Occupation);
}
CALabel* p_Name = (CALabel*)cell->getSubviewByTag(NAME);
p_Name->setText(p_List->name.c_str());
CALabel* p_Num = (CALabel*)cell->getSubviewByTag(NUM);
p_Num->setText(p_List->num.c_str());
CALabel* p_Gender = (CALabel*)cell->getSubviewByTag(GENDER);
p_Gender->setText(p_List->gender.c_str());
CALabel* p_Occupation = (CALabel*)cell->getSubviewByTag(OCCUPATION);
p_Occupation->setText(p_List->occupation.c_str());
return cell;
}
示例3: tableCellAtIndex
CATableViewCell* PageMenu::tableCellAtIndex(CATableView *table, unsigned int section, unsigned int row)
{
CATableViewCell* cell = table->dequeueReusableCellWithIdentifier("aaa");
if (cell == NULL)
{
cell = CATableViewCell::create("aaa");
cell->setBackGroundViewForState(CAControlStateSelected, CAView::createWithColor(ccc4(89, 104, 109, 255)));
cell->setBackGroundViewForState(CAControlStateHighlighted, CAView::createWithColor(ccc4(89, 104, 109, 255)));
cell->setBackGroundViewForState(CAControlStateNormal, CAView::createWithColor(ccc4(0, 0, 0, 0)));
}
cell->removeAllSubviews();
if ( row < m_bookData.m_vecMenu.size() )
{
MenuCell *pIcon = new MenuCell( this );
pIcon->LoadFromBookMenuData( &m_bookData.m_vecMenu[row] );
pIcon->UpdateStatus( BookDB::Instance()->GetBookMenuDownloadStatus( &m_bookData , row ) , BookDB::Instance()->GetBookMenuReadStatus( &m_bookData , row ) );
cell->addSubview(pIcon);
pIcon->release();
m_vecMenuCell[row] = pIcon;
}
return cell;
}
示例4: tableCellAtIndex
CATableViewCell* CAPickerView::tableCellAtIndex(CATableView* table, const CCSize& cellSize, unsigned int section, unsigned int row)
{
if (m_dataSource && !m_tableViews.empty())
{
CATableViewCell* cell = table->dequeueReusableCellWithIdentifier("CrossApp");
if (cell == NULL)
{
cell = CATableViewCell::create("CrossApp");
cell->setBackgroundView(NULL);
}
else
{
cell->removeSubviewByTag(100);
}
size_t component = m_tableViews.getIndex(table);
CAView* view = viewForRowInComponent((unsigned int)component, row, cellSize);
if (view)
{
view->setTag(100);
cell->addSubview(view);
}
return cell;
}
return NULL;
}
示例5: tableCellAtIndex
CATableViewCell* RootViewController::tableCellAtIndex(CATableView *table, unsigned int section, unsigned int row)
{
CATableViewCell* cell = table->dequeueReusableCellWithIdentifier("aaa");
if (cell == NULL)
{
cell = CATableViewCell::create("aaa");
//cell->setBackGroundView(NULL);
}
CCString* str = CCString::createWithFormat("CELL - %u", row);
CCLabelTTF* ttf = CCLabelTTF::create(str->getCString(), "Arial", 40);
ttf->setColor(ccBLACK);
ttf->setFrame(CCRect(10, 60, 0, 0));
cell->addSubview(ttf);
// CALabel* label = CALabel::create(CCRect(0, 0, 600, 100));
// label->setOpacity(128);
// label->setVerticalTextAlignmet(kCCVerticalTextAlignmentCenter);
// label->setCenterOrigin(CCPoint(300, 60));
// label->setText(str->getCString());
// cell->addSubview(label);
return cell;
}
示例6: tableCellAtIndex
CATableViewCell* CAAlertView::tableCellAtIndex(CATableView* table, unsigned int section, unsigned int row)
{
CATableViewCell* cell = table->dequeueReusableCellWithIdentifier("cellID");
if (cell == NULL)
{
cell = CATableViewCell::create("cellID");
cell->addSubview(m_vAllBtn[row]);
m_vAllBtn[row]->setCenterOrigin(m_vAllBtn[row]->getBounds().size / 2);
}
return cell;
}
示例7: tableCellAtIndex
CATableViewCell* FirstViewController::tableCellAtIndex(CATableView* table, const CCSize& cellSize, unsigned int section, unsigned int row)
{
CADipSize _size = cellSize;
CATableViewCell* cell = table->dequeueReusableCellWithIdentifier("CrossApp");
if (cell == NULL)
{
cell = CATableViewCell::create("CrossApp");
CALabel* test = CALabel::createWithCenter(CADipRect(_size.width*0.5,
_size.height*0.5,
_size.width*0.8,
_size.height));
test->setColor(ccc4(51, 204, 255, 255));
test->setTextAlignment(CATextAlignmentCenter);
test->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
test->setFontSize(_px(40));
test->setTag(100);
cell->addSubview(test);
}
CALabel* test = (CALabel*)cell->getSubviewByTag(100);
test->setText(testList.at(row));
return cell;
}