当前位置: 首页>>代码示例>>C++>>正文


C++ CALabel::setTextAlignment方法代码示例

本文整理汇总了C++中CALabel::setTextAlignment方法的典型用法代码示例。如果您正苦于以下问题:C++ CALabel::setTextAlignment方法的具体用法?C++ CALabel::setTextAlignment怎么用?C++ CALabel::setTextAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CALabel的用法示例。


在下文中一共展示了CALabel::setTextAlignment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: showAlert

void CDNewsViewController::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(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(CDNewsViewController::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(_px(24));
    test->setText("网络不给力,请点击屏幕重新加载~");
    p_alertView->addSubview(test);
    
}
开发者ID:bazhi,项目名称:CrossApp,代码行数:35,代码来源:CDNewsViewController.cpp

示例2: collectionCellAtIndex

CACollectionViewCell* AutoCollectionViewHorizontalTest::collectionCellAtIndex(CAAutoCollectionView *collectionView, const DSize& cellSize, unsigned int section, unsigned int item)
{
    CACollectionViewCell* p_Cell = collectionView->dequeueReusableCellWithIdentifier("CrossApp");

    if (p_Cell == NULL)
    {
        p_Cell = CACollectionViewCell::create("CrossApp");
        
        CAView* itemImage = CAView::createWithLayout(DLayoutFill);
        itemImage->setTag(99);
        p_Cell->getContentView()->addSubview(itemImage);
        
        CALabel* itemText = CALabel::createWithLayout(DLayoutFill);
        itemText->setTag(100);
        itemText->setFontSize(29);
        itemText->setTextAlignment(CATextAlignmentCenter);
        itemText->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
        p_Cell->getContentView()->addSubview(itemText);
    }

    CAView* itemImageView = p_Cell->getContentView()->getSubviewByTag(99);
    itemImageView->setColor(HorizontalcolorArr.at(item));
    CCLog("row = %d", item);
    
    char pos[20] = "";
    sprintf(pos, "(%d,%d)", section, item);
    CALabel* itemText = (CALabel*)p_Cell->getContentView()->getSubviewByTag(100);
    itemText->setText(pos);
    return  p_Cell;
    
}
开发者ID:WoYang,项目名称:CrossApp,代码行数:31,代码来源:AutoCollectionViewHorizontalTest.cpp

示例3: 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;
}
开发者ID:WoYang,项目名称:CrossApp,代码行数:28,代码来源:ListViewTest.cpp

示例4: tableViewSectionViewForHeaderInSection

CAView* HeroInfoController::tableViewSectionViewForHeaderInSection(CATableView* table, const CCSize& viewSize, unsigned int section)
{
	CAView* _headView;
	_headView = CAView::createWithColor(COLOR_GRAY);
	CALabel* label = CALabel::createWithFrame(CCRect(10, 0, viewSize.width / 10, viewSize.height));
	label->setTextAlignment(CATextAlignmentLeft);
	label->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);

	label->setFontSize(_px(13));
	_headView->addSubview(label);
	if (section == 0)
	{
		label->setText(UTF8ToGBK::transferToGbk("摘要"));
		
	}
	else if (section ==1)
	{
		label->setText(UTF8ToGBK::transferToGbk("英雄属性"));
	}
	else if (section ==2)
	{
		label->setText(UTF8ToGBK::transferToGbk("技能介绍"));
	}
	

	return _headView;
	
}
开发者ID:a752602882,项目名称:DotaMax,代码行数:28,代码来源:HeroInfoController.cpp

示例5: 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);
}
开发者ID:a752602882,项目名称:DotaMax,代码行数:29,代码来源:UtilManager.cpp

示例6: 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);

}
开发者ID:DreamCastleShanghai,项目名称:client_new,代码行数:32,代码来源:VoteViewController.cpp

示例7: 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;
}
开发者ID:lmxing1987,项目名称:CrossApp,代码行数:28,代码来源:CAPickerView.cpp

示例8: 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;
}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:30,代码来源:SecondViewController.cpp

示例9: 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;
}
开发者ID:Super-Man,项目名称:CrossApp,代码行数:30,代码来源:MenuViewController.cpp

示例10: 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);
}
开发者ID:DreamCastleShanghai,项目名称:client_new,代码行数:47,代码来源:NoticeDetailViewController.cpp

示例11: 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);
}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:47,代码来源:ButtonTest.cpp

示例12: 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);
}
开发者ID:chongtianfeiyu,项目名称:CrossApp,代码行数:59,代码来源:SegmentedControlTest.cpp

示例13: 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;

}
开发者ID:ksca686812,项目名称:MyApp_2155,代码行数:57,代码来源:ExchangeViewController.cpp

示例14: 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));
    }
}
开发者ID:foio,项目名称:CrossApp,代码行数:57,代码来源:DMClassifCatalogViewController.cpp

示例15: threeButtonType

void ButtonTest::threeButtonType()
{
	CALabel* buttonType = CALabel::createWithCenter(CCRect(size.width*0.5, size.height*0.05, size.width*0.4, 50));
	buttonType->setText("ButtonType");
	buttonType->setFontSize(30*CROSSAPP_ADPTATION_RATIO);
	buttonType->setTextAlignment(CATextAlignmentCenter);
	buttonType->setColor(ccc4(51, 204, 255, 255));
	this->getView()->addSubview(buttonType);

	CAButton* defaultBtn = CAButton::create(CAButtonTypeCustom);
	defaultBtn->setCenter(CCRect(size.width*0.25-50, size.height*0.15, size.width*0.2, size.height*0.05));
	defaultBtn->setTitleForState(CAControlStateNormal, "Noborder");
	defaultBtn->setTitleColorForState(CAControlStateNormal, ccc4(51, 204, 255, 255));
	this->getView()->addSubview(defaultBtn);

	CALabel* custom = CALabel::createWithCenter(CCRect(size.width*0.25-50, size.height*0.15+80, size.width*0.2, 50));
	custom->setText("(CAButtonTypeCustom)");
	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.15, size.width*0.2, size.height*0.05));
	this->getView()->addSubview(squareRectBtn);

	CALabel* square = CALabel::createWithCenter(CCRect(size.width*0.5, size.height*0.15 + 80, size.width*0.2, 50));
	square->setText("(CAButtonTypeSquareRect)");
	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.15, size.width*0.2, size.height*0.05));
	this->getView()->addSubview(roundedRectBtn);

	CALabel* rounded = CALabel::createWithCenter(CCRect(size.width*0.75+50, size.height*0.15 + 80, size.width*0.2, 50));
	rounded->setText("(CAButtonTypeRoundedRect)");
	rounded->setFontSize(20 * CROSSAPP_ADPTATION_RATIO);
	rounded->setTextAlignment(CATextAlignmentCenter);
	rounded->setColor(ccc4(51, 204, 255, 255));
	this->getView()->addSubview(rounded);
}
开发者ID:AojiaoZero,项目名称:CrossApp,代码行数:44,代码来源:ButtonTest.cpp


注:本文中的CALabel::setTextAlignment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。