本文整理汇总了C++中CALabel类的典型用法代码示例。如果您正苦于以下问题:C++ CALabel类的具体用法?C++ CALabel怎么用?C++ CALabel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CALabel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setNewsInfo
void FSBooklibraryCell::setNewsInfo(NewsInfo *newsinfo)
{
// CCLOG("imageSrc = %s",newsinfo->getImageSrc());
string strImage = "news/"+newsinfo->getImageSrc();
//
//
//// tabbar_function/bookRankingList_1.png
//// CAImage* image=CAImage::create(strImage);
//
// CAImage* image=CAImage::create("tabbar_function/bookRankingList_1.png");
//
// itemText->setText(strImage);
//itemText->setText("123123");
//image->autorelease();
// itemImage->setImage(image);
CAImageView *itemImage = (CAImageView*)this->getSubviewByTag(99);
CAImage* image=CAImage::create(strImage);
itemImage->setImage(image);
CALabel* itemText = (CALabel*)this->getSubviewByTag(99)->getSubviewByTag(100);
itemText->setText(newsinfo->getNewsTitle());
}
示例2: CALabel
void FSNewsView2::calcPagingRule()
{
float screenHeight = CrossApp::CCEGLView::sharedOpenGLView()->getDesignResolutionSize().height;
CALabel *calcLabel = new CALabel();
screenHeight = screenHeight - NEWSCELLBOTTOMHEIGHT-NEWSCELLTOPHEIGHT;
float screenWidth = CrossApp::CCEGLView::sharedOpenGLView()->getDesignResolutionSize().width;
// screenWidth = screenWidth - NEWSCELLTOPHEIGHT*2;
float curFontSize = CrossApp::CCEGLView::sharedOpenGLView()->getDesignResolutionSize().width / smallResource.size.width * 32;
calcLabel->setFontSize(curFontSize);
int lineFontHeihtItem = calcLabel->getLineFontHeight();
m_PagingRule.lineNumber = screenHeight/lineFontHeihtItem;
int fontWidthItem = calcLabel->getFontCNUTF8Width();
m_PagingRule.lineTextNumber = screenWidth/fontWidthItem -1;
float preciseLineNumber = screenHeight/lineFontHeihtItem;
if(preciseLineNumber-m_PagingRule.lineNumber <= 0.5)
{
m_PagingRule.lineNumber--;
}
}
示例3: initWithSize
void FSBooklibraryCell::initWithSize(CADipSize& cellSize)
{
CADipSize _size = cellSize;
// itemImage = CAImageView::createWithFrame(CADipRect(0, 0, _size.width, _size.height));
// itemImage->setTag(99);
// this->addSubview(itemImage);
// CADipSize itemSize = itemImage->getBounds().size;
// CALabel* itemText = CALabel::createWithCenter(CADipRect(_size.width*0.5, _size.height*0.5, 150, 40));
// itemText->setTag(100);
// itemText->setFontSize(_px(29));
// itemText->setTextAlignment(CATextAlignmentCenter);
// itemText->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
// itemImage->addSubview(itemText);
CAImageView* itemImage = CAImageView::createWithFrame(CADipRect(0, 0, _size.width, _size.height*4/5));
itemImage->setTag(99);
this->addSubview(itemImage);
CADipSize itemSize = itemImage->getBounds().size;
CALabel* itemText = CALabel::createWithCenter(CADipRect(itemSize.width*0.5, itemSize.height+20, 150, 40));
itemText->setTag(100);
itemText->setFontSize(_px(29));
itemText->setTextAlignment(CATextAlignmentCenter);
itemText->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
itemImage->addSubview(itemText);
// this->setControlCanSelected(false);
}
示例4: CADipRect
CATableViewCell* FSNewsAboutController::tableCellAtIndex(CATableView* table, const CCSize& cellSize, unsigned int section, unsigned int row)
{
CADipSize _size = cellSize;
FSNewsAboutTableCell* cell = dynamic_cast<FSNewsAboutTableCell*>(table->dequeueReusableCellWithIdentifier("NewsAboutCell"));
if (cell == NULL)
{
cell = FSNewsAboutTableCell::create("NewsAboutCell", CADipRect(0, 0, _size.width, _size.height));
cell->initWithCell();
}
CALabel* cellText = (CALabel*)cell->getSubviewByTag(100);
// CASwitch* cellBtn = (CASwitch*)cell->getSubviewByTag(103);
// cellBtn->setVisible(false);
// switch (section) {
// case 0:
// cellText->setText(unicode_to_utf8(aboutMenuTag[row]));
// break;
// case 1:
// cellText->setText(unicode_to_utf8(aboutMenuTag[row + 2]));
// if (row==2||row==3||row==4) {
// cellBtn->setVisible(true);
// };
// break;
// case 2:
// cellText->setText(unicode_to_utf8(aboutMenuTag[row + 8]));
// break;
// }
cellText->setText(unicode_to_utf8(aboutMenuTag[row]));
return cell;
}
示例5: 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);
}
}
}
示例6: 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;
}
示例7: CALabel
CALabel *CALabel::create(CCRect frame)
{
CALabel *label = new CALabel();
if (label && label->initWithFrame(frame))
{
label->autorelease();
return label;
}
CC_SAFE_DELETE(label);
return NULL;
}
示例8: CALabel
CALabel *CALabel::createWithFrame(const CCRect& rect)
{
CALabel *label = new CALabel();
if (label && label->initWithFrame(rect))
{
label->autorelease();
return label;
}
CC_SAFE_DELETE(label);
return NULL;
}
示例9: CALabel
CALabel *CALabel::create()
{
CALabel *label = new CALabel();
if (label && label->init())
{
label->autorelease();
return label;
}
CC_SAFE_DELETE(label);
return NULL;
}
示例10: viewDidLoad
void ContactViewController::viewDidLoad() {
//this->getNavigationController()->setTitle("联系我");
CADipSize __winSize = this->getView()->getBounds().size;
CALabel *lable = CALabel::createWithFrame(CADipRect(0,0,__winSize.width,__winSize.height));
lable->setText("如有任何问题请联系我。QQ:254069025,邮箱:[email protected] .帮本人介绍对象者,事成之后有重谢^_^");
lable->setTextAlignment(CATextAlignmentCenter);
lable->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
lable->setFontSize(_px(40));
this->getView()->addSubview(lable);
}
示例11: initWithCell
void FSBookReadTimesCell::initWithCell()
{
CADipSize _size = this->getBounds().size;
// CAView *view = CAView::createWithFrame(this->getBounds());
// view->setTag(99);
// this->addSubview(view);
CAImageView* itemImage = CAImageView::createWithFrame(CADipRect(LEFTSPACE, TOPSPACE, (_size.height-TOPSPACE-BOTTOMSPACE)*3/4, _size.height-TOPSPACE-BOTTOMSPACE));
itemImage->setTag(99);
this->addSubview(itemImage);
// CADipSize itemSize = itemImage->getBounds().size;
// CALabel* itemText = CALabel::createWithCenter(CADipRect(itemSize.width*0.5, itemSize.height+20, 150, 40));
// itemText->setTag(100);
// itemText->setFontSize(_px(29));
// itemText->setTextAlignment(CATextAlignmentCenter);
// itemText->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
// itemImage->addSubview(itemText);
CALabel *textTitle = CALabel::createWithFrame(CADipRect(itemImage->getFrame().size.width+LEFTSPACE*2, TOPSPACE, _size.width-itemImage->getFrame().size.width-LEFTSPACE*2, (_size.height-TOPSPACE-BOTTOMSPACE)/2));
textTitle->setTag(100);
textTitle->setFontSize(_px(29));
textTitle->setTextAlignment(CATextAlignmentLeft);
textTitle->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
// textTitle->setColor(ccc4(100,100,100,1));
this->addSubview(textTitle);
CALabel *authorTitle = CALabel::createWithFrame(CADipRect(itemImage->getFrame().size.width+LEFTSPACE*2, TOPSPACE+(_size.height-TOPSPACE-BOTTOMSPACE)/2, _size.width-itemImage->getFrame().size.width-LEFTSPACE-LEFTSPACE, (_size.height-TOPSPACE-BOTTOMSPACE)/2));
authorTitle->setTag(101);
authorTitle->setFontSize(_px(29));
authorTitle->setTextAlignment(CATextAlignmentLeft);
authorTitle->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
this->addSubview(authorTitle);
// CADipSize m_size = this->getFrame().size;
// CALabel* cellText = CALabel::createWithCenter(CADipRect(m_size.width*0.1, m_size.height*0.5, m_size.width*0.3, m_size.height*0.8));
// cellText->setTag(100);
// cellText->setFontSize(_px(30));
// cellText->setTextAlignment(CATextAlignmentCenter);
// cellText->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
// this->addSubview(cellText);
// CAButton* btnOnCell = CAButton::createWithCenter(CADipRect(m_size.width*0.85, m_size.height*0.5, m_size.width*0.2, m_size.height*0.7), CAButtonTypeRoundedRect);
// btnOnCell->setTag(102);
// btnOnCell->setTitleForState(CAControlStateAll, "Touch");
// btnOnCell->addTarget(this, CAControl_selector(FSBookReadTimesCell::cellBtnCallback), CAControlEventTouchUpInSide);
// this->addSubview(btnOnCell);
}
示例12: _px
void ProductCommentViewController::viewDidLoad()
{
CANavigationBarItem* item = CANavigationBarItem::create(CN_STRING("shangpinpinglun"));
this->setNavigationBarItem(item);
CCSize size = this->getView()->getBounds().size;
CALabel *pLabel = CALabel::createWithCenter(CCRect(size.width / 2, size.height / 2, _px(500), _px(40)));
pLabel->setTextAlignment(CATextAlignmentCenter);
pLabel->setText(CN_STRING("haimeiyouliuyanyo"));
pLabel->setFontSize(_px(40));
pLabel->setColor(MiniColor_font1);
this->getView()->addSubview(pLabel);
}
示例13: DVerticalLayout_H_C
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;
}
示例14: ccc4
CAView* ThirdViewController::collectionViewSectionViewForHeaderInSection(CACollectionView *collectionView, const CCSize& viewSize, unsigned int section)
{
CAView* view = CAView::createWithFrame(CCRect(0, 0, 0, 0), ccc4(224, 224, 224, 255));
CCString* str = CCString::createWithFormat("Section Header - %u", section);
CALabel* label = CALabel::createWithFrame(CCRect(20, 0, 200, viewSize.height));
label->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
label->setFontSize(24);
label->setText(str->getCString());
label->setColor(ccc4(127, 127, 127, 255));
view->addSubview(label);
return view;
}
示例15: updateNewsInfoForCell
void FSBookReadTimesCell::updateNewsInfoForCell(NewsInfo *newsinfo)
{
// CCLOG("imageSrc = %s",newsinfo->getImageSrc());
string strImage = "news/"+newsinfo->getImageSrc();
//
CAImageView *itemImage = (CAImageView*)this->getSubviewByTag(99);
CAImage* image=CAImage::create(strImage);
itemImage->setImage(image);
CALabel* itemText = (CALabel*)this->getSubviewByTag(100);
itemText->setText(newsinfo->getNewsTitle());
CALabel* authorTitle = (CALabel*)this->getSubviewByTag(101);
authorTitle->setText(newsinfo->getAuthor());
}