本文整理汇总了C++中CALabel::setColor方法的典型用法代码示例。如果您正苦于以下问题:C++ CALabel::setColor方法的具体用法?C++ CALabel::setColor怎么用?C++ CALabel::setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CALabel
的用法示例。
在下文中一共展示了CALabel::setColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tableCellAtIndex
CATableViewCell* MenuViewController::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");
cell->setBackgroundView(NULL);
CALabel* test = CALabel::createWithCenter(CADipRect(_size.width/2+30,
_size.height/2,
_size.width,
_size.height));
test->setColor(ccc4(220, 227, 115, 255));
test->setTextAlignment(CATextAlignmentLeft);
test->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
test->setFontSize(_px(32));
test->setColor(CAColor_white);
test->setTag(100);
cell->addSubview(test);
CAImageView* arrow = CAImageView::createWithCenter(CADipRect(_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: buttonBackground
void ButtonTest::buttonBackground()
{
CALabel* buttonImage = CALabel::createWithCenter(CCRect(size.width*0.5, size.height*0.3, size.width*0.4, 50));
buttonImage->setText("ButtonImage");
buttonImage->setFontSize(30 * CROSSAPP_ADPTATION_RATIO);
buttonImage->setTextAlignment(CATextAlignmentCenter);
buttonImage->setColor(ccc4(51, 204, 255, 255));
this->getView()->addSubview(buttonImage);
CAButton* defaultBtn = CAButton::create(CAButtonTypeCustom);
defaultBtn->setCenter(CCRect(size.width*0.25 - 50, size.height*0.4, size.width*0.2, size.height*0.05));
defaultBtn->setTitleForState(CAControlStateNormal, "Normal");
defaultBtn->setTitleForState(CAControlStateSelected,"Selected");
defaultBtn->setTitleForState(CAControlStateHighlighted, "Highlighted");
defaultBtn->setBackGroundViewForState(CAControlStateNormal,CAView::createWithColor(CAColor_green));
defaultBtn->setBackGroundViewForState(CAControlStateHighlighted, CAView::createWithColor(CAColor_yellow));
defaultBtn->setTitleColorForState(CAControlStateAll, ccc4(51, 204, 255, 255));
this->getView()->addSubview(defaultBtn);
CALabel* custom = CALabel::createWithCenter(CCRect(size.width*0.25 - 50, size.height*0.4 + 80, size.width*0.2, 50));
custom->setText("(BackgroundView)");
custom->setFontSize(20 * CROSSAPP_ADPTATION_RATIO);
custom->setTextAlignment(CATextAlignmentCenter);
custom->setColor(ccc4(51, 204, 255, 255));
this->getView()->addSubview(custom);
CAButton* squareRectBtn = CAButton::create(CAButtonTypeSquareRect);
squareRectBtn->setCenter(CCRect(size.width*0.5, size.height*0.4, size.width*0.2, size.height*0.05));
squareRectBtn->setImageForState(CAControlStateNormal,CAImage::create("square_nor.png"));
squareRectBtn->setImageForState(CAControlStateHighlighted, CAImage::create("square_sel.png"));
this->getView()->addSubview(squareRectBtn);
CALabel* square = CALabel::createWithCenter(CCRect(size.width*0.5, size.height*0.4 + 80, size.width*0.2, 50));
square->setText("(StateImage)");
square->setFontSize(20 * CROSSAPP_ADPTATION_RATIO);
square->setTextAlignment(CATextAlignmentCenter);
square->setColor(ccc4(51, 204, 255, 255));
this->getView()->addSubview(square);
CAButton* roundedRectBtn = CAButton::create(CAButtonTypeRoundedRect);
roundedRectBtn->setCenter(CCRect(size.width*0.75 + 50, size.height*0.4, size.width*0.2, size.height*0.05));
roundedRectBtn->setControlState(CAControlStateDisabled);
this->getView()->addSubview(roundedRectBtn);
CALabel* rounded = CALabel::createWithCenter(CCRect(size.width*0.75 + 50, size.height*0.4 + 80, size.width*0.2, 50));
rounded->setText("(Disabled)");
rounded->setFontSize(20 * CROSSAPP_ADPTATION_RATIO);
rounded->setTextAlignment(CATextAlignmentCenter);
rounded->setColor(ccc4(51, 204, 255, 255));
this->getView()->addSubview(rounded);
}
示例3: initWithCell
void CDNewsImageTableCell::initWithCell(int num)
{
cell_tag = CCRANDOM_0_1()*4+1;
DSize _size = this->getFrame().size;
CALabel* test = CALabel::createWithFrame(DRect(40,
_size.height-150,
_size.width-90,
40));
test->setColor(CAColor_black);
test->setTextAlignment(CATextAlignmentLeft);
test->setVerticalTextAlignmet(CAVerticalTextAlignmentTop);
test->setFontSize(32);
test->setBold(true);
test->setTag(100);
this->addSubview(test);
CALabel* dsc = CALabel::createWithFrame(DRect(40,
_size.height-90,
_size.width-90,
70));
dsc->setColor(CAColor_black);
dsc->setTextAlignment(CATextAlignmentLeft);
dsc->setVerticalTextAlignmet(CAVerticalTextAlignmentTop);
dsc->setFontSize(26);
dsc->setTag(101);
dsc->setColor(ccc4(200, 200, 200, 255));
this->addSubview(dsc);
CommonUrlImageView* temImage = CommonUrlImageView::createWithFrame(DRect(0,5,_size.width,_size.height-180));
temImage->setTag(200);
temImage->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
CommonUrlImageView* temImage1 = CommonUrlImageView::createWithFrame(DRect(0,5,_size.width,_size.height-180));
temImage1->setTag(201);
temImage1->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
CommonUrlImageView* temImage2 = CommonUrlImageView::createWithFrame(DRect(0,5,_size.width,_size.height-180));
temImage2->setTag(202);
temImage2->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
CommonUrlImageView* temImage3 = CommonUrlImageView::createWithFrame(DRect(0,5,_size.width,_size.height-180));
temImage3->setTag(203);
temImage3->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
this->addSubview(temImage);
this->addSubview(temImage1);
this->addSubview(temImage2);
this->addSubview(temImage3);
}
示例4: initPageView
/*
void MainViewController::initPageView()
{
}
*/
void MainViewController::showAlert()
{
if (p_alertView) {
this->getView()->removeSubview(p_alertView);
p_alertView = NULL;
}
p_alertView = CAView::createWithFrame(DRect((0), (120), m_winSize.width, m_winSize.height - (220)));
this->getView()->addSubview(p_alertView);
CAImageView* bg = CAImageView::createWithFrame(DRect((0), (0), m_winSize.width, m_winSize.height - (220)));
bg->setImageViewScaleType(CAImageViewScaleTypeFitImageXY);
bg->setImage(CAImage::create("common/bg.png"));
bg->setTouchEnabled(false);
CAButton* btn5 = CAButton::create(CAButtonTypeSquareRect);
btn5->setTag(100);
btn5->setFrame(DRect((0), (0), m_winSize.width, m_winSize.height - (220)));
btn5->setTitleColorForState(CAControlStateNormal, CAColor_white);
btn5->setBackgroundViewForState(CAControlStateNormal, bg);
btn5->setBackgroundViewForState(CAControlStateHighlighted, bg);
btn5->addTarget(this, CAControl_selector(MainViewController::buttonCallBack), CAControlEventTouchUpInSide);
p_alertView->addSubview(btn5);
CALabel* test = CALabel::createWithFrame(DRect(0, m_winSize.height - (300), m_winSize.width, (40)));
test->setColor(CAColor_gray);
test->setTextAlignment(CATextAlignmentCenter);
test->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
test->setFontSize((30));
test->setText("Network cannot connect!");
p_alertView->addSubview(test);
}
示例5: tableViewSectionViewForHeaderInSection
CAView* SecondViewController::tableViewSectionViewForHeaderInSection(CATableView* table, const CCSize& viewSize, unsigned int section)
{
CADipSize _viewSize = viewSize;
char head[10] = "";
CAView* view = CAView::createWithColor(ccc4(239,242,243,255));
CAButton* headControl1 = CAButton::createWithCenter(CADipRect(60, _viewSize.height*0.5, 80, 80),
CAButtonTypeRoundedRect);
headControl1->setTag(100 + (int)section);
if (sect[section] == CELL_COUNT)
{
headControl1->setBackGroundViewForState(CAControlStateNormal, CAImageView::createWithImage(CAImage::create("source_material/close1.png")));
}
else
{
headControl1->setBackGroundViewForState(CAControlStateNormal, CAImageView::createWithImage(CAImage::create("source_material/open1.png")));
}
headControl1->addTarget(this, CAControl_selector(SecondViewController::switchCellListInSection), CAControlEventTouchUpInSide);
view->addSubview(headControl1);
CALabel* header = CALabel::createWithCenter(CADipRect(_viewSize.width*0.5, _viewSize.height*0.5, 300, 50));
sprintf(head, "Section-%d", section);
header->setFontSize(_px(30));
header->setText(head);
header->setColor(CAColor_blueStyle);
header->setTextAlignment(CATextAlignmentCenter);
header->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
view->addSubview(header);
return view;
}
示例6: showAlert
void CDNewsImageController::showAlert()
{
p_alertView = CAView::createWithFrame(this->getView()->getBounds());
this->getView()->addSubview(p_alertView);
CAImageView* bg = CAImageView::createWithFrame(DRect(0,0,winSize.width,winSize.height));
bg->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
bg->setImage(CAImage::create("image/HelloWorld.png"));
CAButton* btn5 = CAButton::create(CAButtonTypeSquareRect);
btn5->setTag(100);
btn5->setCenter(DRect(winSize.width/2, winSize.height/2, winSize.width, winSize.height));
btn5->setTitleColorForState(CAControlStateNormal,CAColor_white);
btn5->setBackgroundViewForState(CAControlStateNormal, bg);
btn5->setBackgroundViewForState(CAControlStateHighlighted, bg);
btn5->addTarget(this, CAControl_selector(CDNewsImageController::buttonCallBack), CAControlEventTouchUpInSide);
p_alertView->addSubview(btn5);
CALabel* test = CALabel::createWithCenter(DRect(winSize.width/2,
winSize.height-100,
winSize.width,
40));
test->setColor(CAColor_gray);
test->setTextAlignment(CATextAlignmentCenter);
test->setVerticalTextAlignmet(CAVerticalTextAlignmentTop);
test->setFontSize(24);
test->setText("网络不给力,请点击屏幕重新加载~");
p_alertView->addSubview(test);
}
示例7: toast
void UtilManager::toast(string text, CAViewController* object) {
CAApplication::getApplication()->getRootWindow()->removeSubviewByTag(TOAST_VIEW_TAG);
CCSize winSize = CAApplication::getApplication()->getWinSize();
//CAView *back = CAView::createWithCenter(CCRect(winSize.width*0.5, winSize.height*0.5, _dip(winSize.width)*0.3, _dip(winSize.height)*0.3));
CAView *back = CAView::createWithCenter(CCRect(winSize.width*0.5, winSize.height*0.5, 180 * getScale(), 30 * getScale()));
back->setTag(TOAST_VIEW_TAG);
back->setColor(ccc4(31, 31, 31, 200));//40
CALabel *title = CALabel::createWithCenter(CADipRect(_dip(back->getBounds().size.width*0.5),
_dip(back->getBounds().size.height*0.5), 180 * getScale(), 30 * getScale()));
// title->setText(UTF8ToGBK::transferToGbk(text));
title->setText(text);
//title->setText("sssss");
// title->setFontName(getChineseFont());
title->setColor(CAColor_white);
title->setTextAlignment(CATextAlignmentCenter);
title->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
title->setFontSize(_px(15));
back->addSubview(title);
//CAApplication::getApplication()->getRootWindow()->getRootViewController()->getView()->addSubview(back);
back->runAction(CCFadeOut::create(1));
//CAApplication::getApplication()->getRootWindow()->addSubview(back);
object->getView()->addSubview(back);
//CCLog("%s", get_date_now().c_str());
scheduleOnce(schedule_selector(UtilManager::removeToast), this, TOAST_TIME);
}
示例8: 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;
}
示例9: showAlert
void SessionsViewController::showAlert()
{
if (p_alertView) {
this->getView()->removeSubview(p_alertView);
p_alertView = NULL;
}
p_alertView = CAView::createWithFrame(this->getView()->getBounds());
this->getView()->addSubview(p_alertView);
CAImageView* bg = CAImageView::createWithFrame(DRect(_px(0), _px(120), m_winSize.width, m_winSize.height - _px(120)));
bg->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
bg->setImage(CAImage::create("common/bg.png"));
CAButton* btn5 = CAButton::create(CAButtonTypeSquareRect);
btn5->setTag(100);
btn5->setFrame(DRect(_px(0), _px(120), m_winSize.width, m_winSize.height - _px(120)));
btn5->setTitleColorForState(CAControlStateNormal, CAColor_white);
btn5->setBackGroundViewForState(CAControlStateNormal, bg);
btn5->setBackGroundViewForState(CAControlStateHighlighted, bg);
btn5->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
p_alertView->addSubview(btn5);
CALabel* test = CALabel::createWithCenter(DRect(m_winSize.width / 2, (m_winSize.height - _px(120)) / 2, m_winSize.width, m_winSize.height - _px(120)));
test->setColor(CAColor_gray);
test->setTextAlignment(CATextAlignmentCenter);
test->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
test->setFontSize(_px(24));
test->setText("Network cannot connected !");
p_alertView->addSubview(test);
}
示例10: viewForRowInComponent
CAView* CAPickerView::viewForRowInComponent(int component, int row, CCSize size)
{
int index = m_componentsIndex[component][row];
if (index == -1)
{
return NULL;
}
CAView* view = m_dataSource->viewForRow(this, index, component);
if (!view)
{ // create view
CCString* title = m_dataSource->titleForRow(this, index, component);
if (title && title->length() > 0)
{
CCRect rect = CCRectMake(0, 0, size.width, size.height);
CALabel* label = CALabel::createWithFrame(rect);
label->setText(title->getCString());
label->setColor(m_fontColorNormal);
label->setFontSize(m_fontSizeNormal);
label->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
label->setTextAlignment(CATextAlignmentCenter);
return label;
}
}
return view;
}
示例11: viewDidLoad
void NoticeDetailViewController::viewDidLoad()
{
// Do any additional setup after loading the view from its nib.
m_winSize = this->getView()->getBounds().size;
CAScale9ImageView* sView = CAScale9ImageView::createWithImage(CAImage::create("common/sky_bg.png"));
sView->setFrame(DRect((0), (0), m_winSize.width, (120)));
this->getView()->addSubview(sView);
CAButton* button = CAButton::createWithFrame(DRect((0), (20), (100), (100)), CAButtonTypeCustom);
CAImageView* imageView = CAImageView::createWithImage(CAImage::create("common/nav_back.png"));
imageView->setImageViewScaleType(CAImageViewScaleTypeFitImageXY);
imageView->setFrame(DRect((20), (20), (80), (80)));
button->setBackgroundViewForState(CAControlStateAll, imageView);
button->addTarget(this, CAControl_selector(NoticeDetailViewController::buttonCallBack), CAControlEventTouchUpInSide);
button->setTag(20);
sView->addSubview(button);
CALabel* label = CALabel::createWithCenter(DRect(m_winSize.width / 2, (70), m_winSize.width, (50)));
label->setTextAlignment(CATextAlignmentCenter);
label->setColor(CAColor_white);
label->setTouchEnabled(false);
label->setFontSize((40));
label->setText("Notice");
label->setFontName(SAP_FONT_ARIAL);
sView->addSubview(label);
label = CALabel::createWithFrame(DRect(0, (200), m_winSize.width, (60)));
label->setTextAlignment(CATextAlignmentCenter);
label->setColor(CAColor_gray);
label->setTouchEnabled(false);
label->setFontSize((40));
label->setText(m_title);
label->setFontName(SAP_FONT_ARIAL);
this->getView()->addSubview(label);
label = CALabel::createWithFrame(DRect(40, (300), m_winSize.width - 80, (800)));
label->setTextAlignment(CATextAlignmentLeft);
label->setColor(CAColor_gray);
label->setTouchEnabled(false);
label->setFontSize((30));
label->setText(m_detail);
label->setFontName(SAP_FONT_ARIAL);
this->getView()->addSubview(label);
CCLog("%f", CAApplication::getApplication()->getWinSize().width);
}
示例12: threeButtonType
void ButtonTest::threeButtonType(void)
{
CADipSize size = typeView->getBounds().size;
CALabel* buttonType = CALabel::createWithCenter(CADipRect(size.width*0.5, size.height*0.2, size.width*0.4, 50));
buttonType->setText("DefaultType");
buttonType->setFontSize(_px(30));
buttonType->setTextAlignment(CATextAlignmentCenter);
buttonType->setColor(ccc4(51, 204, 255, 255));
typeView->addSubview(buttonType);
CAButton* defaultBtn = CAButton::create(CAButtonTypeCustom);
defaultBtn->setCenter(CADipRect(size.width*0.25 - 50, size.height*0.5, size.width*0.25, size.height*0.1));
defaultBtn->setTitleForState(CAControlStateNormal, "Noborder");
defaultBtn->setTitleColorForState(CAControlStateNormal, CAColor_blueStyle);
typeView->addSubview(defaultBtn);
CALabel* custom = CALabel::createWithCenter(CADipRect(size.width*0.25 - 50, size.height*0.5 + 80, size.width*0.3, 50));
custom->setText("(Custom)");
custom->setFontSize(_px(20));
custom->setTextAlignment(CATextAlignmentCenter);
custom->setColor(ccc4(51, 204, 255, 255));
typeView->addSubview(custom);
CAButton* squareRectBtn = CAButton::create(CAButtonTypeSquareRect);
squareRectBtn->setCenter(CADipRect(size.width*0.5, size.height*0.5, size.width*0.25, size.height*0.1));
squareRectBtn->setTitleForState(CAControlStateAll,"SquareRect");
typeView->addSubview(squareRectBtn);
CALabel* square = CALabel::createWithCenter(CADipRect(size.width*0.5, size.height*0.5 + 80, size.width*0.3, 50));
square->setText("(SquareRect)");
square->setFontSize(_px(20));
square->setTextAlignment(CATextAlignmentCenter);
square->setColor(CAColor_blueStyle);
typeView->addSubview(square);
CAButton* roundedRectBtn = CAButton::create(CAButtonTypeRoundedRect);
roundedRectBtn->setCenter(CADipRect(size.width*0.75 + 50, size.height*0.5, size.width*0.25, size.height*0.1));
roundedRectBtn->setTitleForState(CAControlStateAll, "RoundedRect");
typeView->addSubview(roundedRectBtn);
CALabel* rounded = CALabel::createWithCenter(CADipRect(size.width*0.75 + 50, size.height*0.5 + 80, size.width*0.3, 50));
rounded->setText("(RoundedRect)");
rounded->setFontSize(_px(20));
rounded->setTextAlignment(CATextAlignmentCenter);
rounded->setColor(CAColor_blueStyle);
typeView->addSubview(rounded);
}
示例13: viewDidLoad
void SegmentedControlTest::viewDidLoad()
{
char segNormal[50] = "";
char segHighlighted[50] = "";
char segSelected[50] = "";
char pages[10] = "";
size = this->getView()->getBounds().size;
CALabel* defaultStyle = CALabel::createWithCenter(CADipRect(size.width*0.5,size.height*0.05,size.width*0.5,50));
defaultStyle->setText("Default Style");
defaultStyle->setFontSize(_px(30));
defaultStyle->setColor(CAColor_blueStyle);
defaultStyle->setTextAlignment(CATextAlignmentCenter);
defaultStyle->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
this->getView()->addSubview(defaultStyle);
CASegmentedControl* defaultSegment = CASegmentedControl::createWithCenter(CADipRect(size.width*0.5,
size.height*0.15,
size.width*0.8,
size.height*0.1), 3);
defaultSegment->setSelectedAtIndex(1);
this->getView()->addSubview(defaultSegment);
CCLog("%f",size.height);
segment = CASegmentedControl::createWithCenter(CADipRect(size.width*0.5,
size.height*0.3,
size.width*0.8,
size.height*0.1), 3);
for (int i = 0; i < 3; i++)
{
sprintf(segNormal,"source_material/seg_normal%d.png",i+1);
sprintf(segHighlighted,"source_material/seg_highlighted%d.png",i+1);
sprintf(segSelected,"source_material/seg_selected%d.png",i+1);
sprintf(pages, "Number%d", i + 1);
segment->setTitleAtIndex(pages, i, CAControlStateAll);
segment->setBackgroundImageAtIndex(CAImage::create(segNormal), i, CAControlStateNormal);
segment->setBackgroundImageAtIndex(CAImage::create(segHighlighted), i, CAControlStateHighlighted);
segment->setBackgroundImageAtIndex(CAImage::create(segSelected), i, CAControlStateSelected);
}
segment->setTitleColorAtIndex(CAColor_white, 0, CAControlStateAll);
segment->setTitleColorAtIndex(CAColor_gray, 1, CAControlStateAll);
segment->setTitleColorAtIndex(CAColor_yellow, 2, CAControlStateAll);
segment->setSelectedAtIndex(1);
segment->addTarget(this, CAControl_selector(SegmentedControlTest::segmentCallback));
this->getView()->addSubview(segment);
defaultView = CAView::createWithColor(ccc4(150,150,150,150));
defaultView->setCenter(CADipRect(size.width*0.5, size.height*0.6 + 1, size.width*0.8, size.height*0.5));
this->getView()->addSubview(defaultView);
CADipSize viewSize = defaultView->getFrame().size;
defaultPage = CALabel::createWithCenter(CADipRect(viewSize.width*0.5,
viewSize.height*0.5,
viewSize.width*0.4, 50));
defaultPage->setText("The second page");
defaultPage->setFontSize(_px(30));
defaultPage->setColor(CAColor_white);
defaultPage->setTextAlignment(CATextAlignmentCenter);
defaultView->addSubview(defaultPage);
}
示例14: tableCellAtIndex
CATableViewCell* ExchangeViewController::tableCellAtIndex(CATableView* table, const CCSize& cellSize, unsigned int section, unsigned int row)
{
CCLog("row = %d , section = %d", row, section);
CADipSize _size = cellSize;
CATableViewCell* p_Cell = p_TableView->dequeueReusableCellWithIdentifier("2155");
if (p_Cell == NULL )
{
p_Cell = CATableViewCell::create("2155");
p_Cell->setAllowsSelected(false);
CAView* itemImage = CAView::createWithFrame(CADipRect(0, 0, _size.width, _size.height));
itemImage->setColor(ccc4(244, 243, 243, 255));
itemImage->setTag(99);
p_Cell->addSubview(itemImage);
CADipSize itemSize = itemImage->getBounds().size;
CALabel* itemText = CALabel::createWithCenter(CADipRect(itemSize.width/2, itemSize.height/3, itemSize.width,40));
itemText->setTag(100);
itemText->setFontSize(_px(35));
itemText->setTextAlignment(CATextAlignmentCenter);
itemText->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
p_Cell->addSubview(itemText);
CALabel* itemText2 = CALabel::createWithCenter(CADipRect(itemSize.width/2, itemSize.height/5*4, itemSize.width,40));
itemText2->setTag(101);
itemText2->setFontSize(_px(25));
itemText2->setTextAlignment(CATextAlignmentCenter);
itemText2->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
p_Cell->addSubview(itemText2);
CAScale9ImageView* iv = CAScale9ImageView::createWithCenter(CADipRect(itemSize.width-50,itemSize.height/2,50,50));
iv->setImage(CAImage::create("source_material/cell_btn_right.png"));
iv->setTag(101);
p_Cell->addSubview(iv);
CAImageView* icon = CAImageView::createWithCenter(CADipRect(50,itemSize.height/2,64,64));
icon->setTag(101);
icon->setScale(0.6f);
icon->setImage(CAImage::create("source_material/btn_right_blue.png"));
p_Cell->addSubview(icon);
}
CALabel * label = (CALabel*)p_Cell->getSubviewByTag(100);
label->setText( unicode_to_utf8(exChangeMenuTag[row]) );
label->setColor(CAColor_black);
CALabel* label2 = (CALabel*)p_Cell->getSubviewByTag(101);
label2->setText(unicode_to_utf8(exChangeMenuTag2[row]));
label2->setColor(CAColor_gray);
return p_Cell;
}
示例15: viewDidLoad
void DMClassifCatalogViewController::viewDidLoad()
{
CADipRect rect = this->getView()->getBounds();
rect.size.height = 96;
m_uiItems = (unsigned int)(rect.size.width / 300);
m_uiItems = MIN(m_uiItems, 5);
m_uiItems = MAX(m_uiItems, 3);
CAView* bar = CAView::createWithFrame(rect, ccc4(87, 154, 244, 255));
this->getView()->insertSubview(bar, 1);
CADipRect titleRect;
titleRect.origin = rect.size/2;
titleRect.size.width = rect.size.width * 0.5f;
titleRect.size.height = rect.size.height;
CALabel* label = CALabel::createWithCenter(titleRect);
label->setNumberOfLine(1);
label->setFontSize(_px(32));
label->setColor(CAColor_white);
label->setTextAlignment(CATextAlignmentCenter);
label->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
label->setText(m_sTitle);
bar->addSubview(label);
CCRect btnRect;
btnRect.size.width = rect.size.height * 0.9f;
btnRect.size.height = rect.size.height * 0.8f;
btnRect.origin.x = btnRect.size.width * 0.7f;
btnRect.origin.y = rect.size.height * 0.5f;
CAButton* button = CAButton::createWithCenter(btnRect, CAButtonTypeCustom);
button->setImageForState(CAControlStateNormal, CAImage::create("source_material/btn_left_white.png"));
button->setImageColorForState(CAControlStateHighlighted, CAColor_gray);
bar->addSubview(button);
button->addTarget(this, CAControl_selector(DMIntroductionController::onReturn), CAControlEventTouchUpInSide);
std::map<string, string> key_value;
CommonHttpManager::getInstance()->send_get(get_url(HttpUrlTypeClassifCatalog, "update", m_sID, "", m_vDatas.size()), key_value, this, CommonHttpJson_selector(DMClassifCatalogViewController::onRequestFinished));
{
CCRect loadingRect = this->getView()->getBounds();
loadingRect.origin.y = _px(96);
loadingRect.size.height -= loadingRect.origin.y;
m_pLoading = CAActivityIndicatorView::createWithFrame(loadingRect);
CAImageView* indicator = CAImageView::createWithFrame(CADipRect(0, 0, 50, 50));
indicator->setImage(CAImage::create(loadingIcon));
m_pLoading->setActivityIndicatorView(indicator);
CAView* bg = CAView::createWithFrame(CADipRect(0, 0, 275, 300), CAColor_clear);
CAImageView* bg2 = CAImageView::createWithFrame(CADipRect(0, 0, 275, 100));
bg2->setImage(CAImage::create(loadingBackground));
bg->addSubview(bg2);
m_pLoading->setActivityBackView(bg);
m_pLoading->setLoadingMinTime(0.4f);
m_pLoading->setColor(CAColor_white);
this->getView()->insertSubview(m_pLoading, CAWindowZoderTop);
m_pLoading->setTargetOnCancel(this, callfunc_selector(DMClassifCatalogViewController::initWithCollectionView));
}
}