本文整理汇总了C++中CAListViewCell::getSubviewByTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CAListViewCell::getSubviewByTag方法的具体用法?C++ CAListViewCell::getSubviewByTag怎么用?C++ CAListViewCell::getSubviewByTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAListViewCell
的用法示例。
在下文中一共展示了CAListViewCell::getSubviewByTag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: listViewCellAtIndex
CAListViewCell* ListViewTest::listViewCellAtIndex(CAListView *listView, const DSize& cellSize, unsigned int index)
{
CAListViewCell* cell = (CAListViewCell*)listView->dequeueReusableCellWithIdentifier("ListViewCell");
if (cell==NULL)
{
cell = CAListViewCell::create("ListViewCell");
CALabel* test = CALabel::createWithLayout(DLayout(DHorizontalLayout_L_W(0, 200), DVerticalLayoutFill));
test->setColor(ccc4(51, 204, 255, 255));
test->setTextAlignment(CATextAlignmentCenter);
test->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
test->setFontSize(28);
test->setTag(100);
cell->addSubview(test);
CAButton* btn = CAButton::createWithLayout(DLayout(DHorizontalLayout_W_C(100, 0.85), DVerticalLayout_H_C(50, 0.5)), CAButtonTypeSquareRect);
btn->setTitleForState(CAControlStateNormal, "btn");
btn->setTag(200);
cell->addSubview(btn);
btn->setTouchEventScrollHandOverToSuperview(false);
}
char temptext[10];
sprintf(temptext, "cell-%d",index);
CALabel* test = (CALabel*)cell->getSubviewByTag(100);
test->setText(temptext);
return cell;
}
示例2: listViewDidDeselectCellAtIndex
void SessionsViewController::listViewDidDeselectCellAtIndex(CAListView *listView, unsigned int index)
{
CAListViewCell* cell = listView->cellForRowAtIndex(index);
if (cell) {
CALabel* text = (CALabel*)cell->getSubviewByTag(100);
if (text) {
text->setColor(SAP_GRAY);
}
}
}
示例3: listViewDidSelectCellAtIndex
void SessionsViewController::listViewDidSelectCellAtIndex(CAListView *listView, unsigned int index)
{
m_navTimeType = index;
m_timeTblId = index;
refreshTableByTime(m_navTimeType);
CAListViewCell* cell = listView->cellForRowAtIndex(index);
if (cell) {
CALabel* text = (CALabel*)cell->getSubviewByTag(100);
if (text) {
text->setColor(CAColor_white);
}
}
/*
if (listView->getTag() == 100) {
CAView * lable = listView->getSubviewByTag(100);
//->setColor(ccc4(0x96, 0x96, 0x96, 255));
}*/
}
示例4: listViewCellAtIndex
CAListViewCell* SessionsViewController::listViewCellAtIndex(CAListView *listView, const DSize& cellSize, unsigned int index)
{
CAListViewCell* cell = NULL;
if (listView->getTag() == 1)
{
DSize _size = cellSize;
cell = (CAListViewCell*)listView->dequeueReusableCellWithIdentifier("ListViewCell");
if (!cell)
{
cell = CAListViewCell::create("ListViewCell");
cell->setColor(ccc4(0xEB, 0xEB, 0xEB, 0xff));
CALabel* test = CALabel::createWithCenter(DRect(_size.width/2,
_size.height/2,
_size.width,
_size.height));
test->setTextAlignment(CATextAlignmentCenter);
test->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
test->setFontSize((28));
test->setTag(100);
CAScale9ImageView* sView = CAScale9ImageView::createWithImage(CAImage::create("common/gray_bg.png"));
sView->setFrame(DRect((0), (0), _size.width, _size.height));
cell->setBackgroundView(sView);
cell->addSubview(test);
}
CALabel* test = (CALabel*)cell->getSubviewByTag(100);
if (m_timeTblId == index)
test->setColor(CAColor_white); // ccc4(0x96, 0x96, 0x96, 255)
else
test->setColor(SAP_GRAY);
if (index == 0)
{
test->setText("All");
}
else
{
test->setText(crossapp_format_string("%2d:00", index + 8));
}
}
/*
else if(listView->getTag() == 2)
{
DSize _size = cellSize;
cell = (CAListViewCell*)listView->dequeueReusableCellWithIdentifier("ListViewCell");
if (!cell)
{
cell = CAListViewCell::create("ListViewCell");
CAButton* button = CAButton::createWithFrame(DRect((20), (20), (120), (40)), CAButtonTypeCustom);
CAScale9ImageView* sView = CAScale9ImageView::createWithFrame(DRect((0), (0), (120), (40)));
sView->setImage(CAImage::create("common/seggreen_bg.png"));
sView->setTouchEnabled(false);
button->addSubview(sView);
//button->setBackgroundViewForState(CAControlStateAll, sView);
sView = CAScale9ImageView::createWithFrame(DRect((0), (0), (120), (40)));
sView->setImage(CAImage::create("common/seggreen_bg.png"));
sView->setColor(ccc4(0x86, 0xBD, 0x45, 0xff));
button->setBackgroundViewForState(CAControlStateSelected, sView);
button->setTitleForState(CAControlStateAll, filterItem[index * 2]);
button->setTitleColorForState(CAControlStateAll, ccc4(0xA0, 0xA0, 0xA0, 0xA0));
button->setTitleFontSize((20));
button->setAllowsSelected(true);
button->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
button->setTag(310 + index * 2);
//m_listButton[index * 2] = button;
cell->addSubview(button);
button = CAButton::createWithFrame(DRect((20), (70), (120), (40)), CAButtonTypeCustom);
sView = CAScale9ImageView::createWithFrame(DRect((0), (0), (120), (40)));
sView->setImage(CAImage::create("common/seggreen_bg.png"));
sView->setTouchEnabled(false);
button->addSubview(sView);
//button->setBackgroundViewForState(CAControlStateAll, sView);
//button->addSubview(sView);
//button->setBackgroundViewForState(CAControlStateAll, sView);
sView = CAScale9ImageView::createWithFrame(DRect((0), (0), (120), (40)));
sView->setImage(CAImage::create("common/btn_round.png"));
sView->setColor(ccc4(0x86, 0xBD, 0x45, 0xff));
button->setBackgroundViewForState(CAControlStateSelected, sView);
button->setTitleForState(CAControlStateAll, filterItem[index * 2 + 1]);
button->setTitleColorForState(CAControlStateAll, CAColor_gray);
button->setTitleFontSize((20));
button->setAllowsSelected(true);
button->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
button->setTag(310 + index * 2 + 1);
//m_listButton[index * 2 + 1] = button;
cell->addSubview(button);
//sView = CAScale9ImageView::createWithImage(CAImage::create("common/gray_bg.png"));
//sView->setFrame(DRect((0), (0), _size.width, _size.height));
//sView->setColor(CAColor_clear);
//cell->setAlpha(0);
//cell->setBackgroundView(sView);
}
}*/
return cell;
}