本文整理汇总了C++中CALabel::setVerticalTextAlignmet方法的典型用法代码示例。如果您正苦于以下问题:C++ CALabel::setVerticalTextAlignmet方法的具体用法?C++ CALabel::setVerticalTextAlignmet怎么用?C++ CALabel::setVerticalTextAlignmet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CALabel
的用法示例。
在下文中一共展示了CALabel::setVerticalTextAlignmet方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: collectionCellAtIndex
CACollectionViewCell* CDUIShowAutoCollectionView::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");
p_Cell->setAllowsSelected(false);
CAView* itemImage = CAView::createWithLayout(DLayout(DLayoutFill));
itemImage->setTag(99);
p_Cell->addSubview(itemImage);
CALabel* itemText = CALabel::createWithLayout(DLayout(DHorizontalLayout_L_R(0,0), DVerticalLayout_B_H(5,80)));
itemText->setTag(100);
itemText->setFontSize(24);
itemText->setTextAlignment(CATextAlignmentCenter);
itemText->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
p_Cell->addSubview(itemText);
CAImageView* icon = CAImageView::createWithLayout(DLayout(DHorizontalLayout_L_R(30,30),DVerticalLayout_T_H(20, 123)));
icon->setImageViewScaleType(CAImageViewScaleTypeFitImageInside);
icon->setTag(101);
icon->setScale(0.6f);
p_Cell->addSubview(icon);
}
CAView* itemImageView = p_Cell->getSubviewByTag(99);
itemImageView->setColor(ccc4(244, 243, 243, 255));
CALabel* itemText = (CALabel*)p_Cell->getSubviewByTag(100);
itemText->setText(m_vTitle.at(item));
itemText->setColor(ccc4(34, 151, 254, 255));
CAImageView* icon = (CAImageView*)p_Cell->getSubviewByTag(101);
icon->setImage(CAImage::create(iconTag[item]));
return p_Cell;
}
示例2: 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;
}
示例3: tableCellAtIndex
CATableViewCell* huafeiPreViewController::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);
CALabel* itemText = CALabel::createWithCenter(CADipRect(_size.width/2, _size.height/2, _size.width-200,80));
itemText->setTag(100);
itemText->setFontSize(_px(30));
itemText->setTextAlignment(CATextAlignmentCenter);
itemText->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
p_Cell->addSubview(itemText);
CALabel* itemText2 = CALabel::createWithCenter(CADipRect(_size.width - 80, _size.height/2, _size.width-200,80));
itemText2->setTag(101);
itemText2->setFontSize(_px(25));
itemText2->setTextAlignment(CATextAlignmentCenter);
itemText2->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
p_Cell->addSubview(itemText2);
}
CALabel * label = (CALabel*)p_Cell->getSubviewByTag(100);
label->setText(unicode_to_utf8(huafeiMenu[row]));
label->setColor(CAColor_black);
CALabel * label1 = (CALabel*)p_Cell->getSubviewByTag(101);
label1->setText(unicode_to_utf8(huafeiMenu[row+4]));
label1->setColor(CAColor_red);
return p_Cell;
}
示例4: loadLongButton
void registerViewController::loadLongButton(){
CAView* _view = CAView::createWithColor(CAColor_blue);
CAView* _view1 = CAView::createWithColor(CAColor_green);
float orgin_y = textFieldCod->getFrame().origin.y + _px(50) + _px(30);
CCSize _size=CAApplication::getApplication()->getWinSize();
authCodeButton = CAButton::createWithCenter(CCRect(_size.width/2,orgin_y+_px(25),_size.width-_px(60),_px(50)),CAButtonTypeRoundedRect);
authCodeButton->setBackGroundViewForState(CAControlStateNormal, _view1);
authCodeButton->setBackGroundViewForState(CAControlStateHighlighted, _view);
authCodeButton->setTitleColorForState(CAControlStateAll, CAColor_white);
authCodeButton->setTitleForState(CAControlStateAll, UTF8("点击获取验证码"));
this->getView()->addSubview(authCodeButton);
CAView* _view2 = CAScale9ImageView::createWithImage(CAImage::create("image/bg1.png"));
CAView* _view3 = CAScale9ImageView::createWithImage(CAImage::create("image/bg1R.png"));
//勾选是否同意按钮
CAButton*m_pArgess = CAButton::createWithFrame(CCRect(30, orgin_y + _px(100), 10, 10),CAButtonTypeCustom);
m_pArgess->setBackGroundViewForState(CAControlStateAll,_view3);
m_pArgess->setTag(99);
m_pArgess->addTarget(this, CAControl_selector(registerViewController::changeButtonView),CAControlEventTouchUpInSide);
this->getView()->addSubview(m_pArgess);
//文字
int argessLabelX = m_pArgess->getFrameOrigin().x + _px(30);
int argessLabelY = m_pArgess->getFrameOrigin().y;
CALabel* argessLabel = CALabel::createWithFrame(CCRect(argessLabelX, argessLabelY, _size.width / 5 * 4, 20));
argessLabel->setText(UTF8("同意Max+协议和隐私政策"));
//argessLabel->set
argessLabel->setTextAlignment(CATextAlignmentLeft);
argessLabel->setVerticalTextAlignmet(CAVerticalTextAlignmentTop);
argessLabel->setFontSize(10);
argessLabel->setColor(CAColor_green);
this->getView()->addSubview(argessLabel);
}
示例5: viewDidLoad
void ImageViewTest::viewDidLoad()
{
size = this->getView()->getBounds().size;
CALabel* originalImage = CALabel::createWithCenter(CADipRect(size.width*0.5, size.height*0.1, size.width*0.4, 50 * CROSSAPP_ADPTATION_RATIO));
originalImage->setText("Original image");
originalImage->setFontSize(_px(30));
originalImage->setColor(ccc4(51, 204, 255, 255));
originalImage->setTextAlignment(CATextAlignmentCenter);
originalImage->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
this->getView()->addSubview(originalImage);
CAImageView* firstImage = CAImageView::createWithImage(CAImage::create("source_material/btn_rounded3D_normal.png"));
firstImage->setCenter(CADipRect(size.width*0.2, size.height*0.15,32,32));
this->getView()->addSubview(firstImage);
CAImageView* secondImage = CAImageView::createWithImage(CAImage::create("source_material/btn_rounded3D_selected.png"));
secondImage->setCenter(CADipRect(size.width*0.5, size.height*0.15,32, 32));
this->getView()->addSubview(secondImage);
CAImageView* thirdImage = CAImageView::createWithImage(CAImage::create("source_material/slider_indicator.png"));
thirdImage->setCenter(CADipRect(size.width*0.8, size.height*0.15,48,48));
this->getView()->addSubview(thirdImage);
CALabel* imageView = CALabel::createWithCenter(CADipRect(size.width*0.25, size.height*0.4, size.width*0.4, _px(50)));
imageView->setText("ImageView");
imageView->setFontSize(_px(30));
imageView->setColor(ccc4(51, 204, 255, 255));
imageView->setTextAlignment(CATextAlignmentCenter);
imageView->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
this->getView()->addSubview(imageView);
CAImageView* firstImageView = CAImageView::createWithImage(CAImage::create("source_material/btn_rounded3D_normal.png"));
firstImageView->setCenter(CADipRect(size.width*0.25, size.height*0.5, size.width*0.4, size.height*0.1));
//firstImageView->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
this->getView()->addSubview(firstImageView);
CAImageView* secondImageView = CAImageView::createWithImage(CAImage::create("source_material/btn_rounded3D_selected.png"));
secondImageView->setCenter(CADipRect(size.width*0.25, size.height*0.65, size.width*0.4, size.height*0.1));
//secondImageView->setImageViewScaleType(CAImageViewScaleTypeFitImageInside);
this->getView()->addSubview(secondImageView);
CAImageView* thirdImageView = CAImageView::createWithImage(CAImage::create("source_material/slider_indicator.png"));
thirdImageView->setCenter(CADipRect(size.width*0.25, size.height*0.8, size.width*0.4, size.height*0.1));
this->getView()->addSubview(thirdImageView);
CALabel* scale9Image = CALabel::createWithCenter(CADipRect(size.width*0.75, size.height*0.4, size.width*0.4, _px(50)));
scale9Image->setText("Scale9Image");
scale9Image->setFontSize(_px(30));
scale9Image->setColor(ccc4(51, 204, 255, 255));
scale9Image->setTextAlignment(CATextAlignmentCenter);
scale9Image->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
this->getView()->addSubview(scale9Image);
CAScale9ImageView* firstScale9Image = CAScale9ImageView::createWithImage(CAImage::create("source_material/btn_rounded3D_normal.png"));
firstScale9Image->setCenter(CADipRect(size.width*0.75, size.height*0.5, size.width*0.4, size.height*0.1));
this->getView()->addSubview(firstScale9Image);
CAScale9ImageView* secondScale9Image = CAScale9ImageView::createWithImage(CAImage::create("source_material/btn_rounded3D_selected.png"));
secondScale9Image->setCenter(CADipRect(size.width*0.75, size.height*0.65, size.width*0.4, size.height*0.1));
this->getView()->addSubview(secondScale9Image);
CAScale9ImageView* thirdScale9Image = CAScale9ImageView::createWithImage(CAImage::create("source_material/slider_indicator.png"));
thirdScale9Image->setCenter(CADipRect(size.width*0.75, size.height*0.8, size.width*0.4, size.height*0.1));
this->getView()->addSubview(thirdScale9Image);
//CAImageView* stImageView = CAImageView::createWithImage(CAImage::create("4.jpg"));
//stImageView->setCenter(CADipRect(size.width*0.25, size.height*0.25, size.width*0.4, size.height*0.2));
////stImageView->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
//this->getView()->addSubview(stImageView);
//CAImageView* pstImageView = CAImageView::createWithImage(CAImage::create("4.jpg"));
//pstImageView->setCenter(CADipRect(size.width*0.25, size.height*0.5, size.width*0.4, size.height*0.2));
//pstImageView->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
//this->getView()->addSubview(pstImageView);
//CAImageView* tImageView = CAImageView::createWithImage(CAImage::create("4.jpg"));
//tImageView->setCenter(CADipRect(size.width*0.25, size.height*0.75, size.width*0.4, size.height*0.2));
//tImageView->setImageViewScaleType(CAImageViewScaleTypeFitViewByHorizontal);
//this->getView()->addSubview(tImageView);
}
示例6: viewDidLoad
void PageMenu::viewDidLoad()
{
g_pCurrentPageMenu = this;
PageBase::viewDidLoad();
CAImageView *pBk = CAImageView::createWithImage(CAImage::create("Bk.png"));
pBk->setFrame( getView()->getFrame() );
getView()->addSubview( pBk );
m_pMenuList = new CATableView();
m_pMenuList->initWithFrame( CCRect( 0 , 0 , getView()->getFrame().size.width , getView()->getFrame().size.height - 120 ) );
m_pMenuList->setTableViewDataSource(this);
m_pMenuList->setTableViewDelegate(this);
m_pMenuList->setTablePullViewHeight( 96 );
//m_pMenuList->setTablePullDownView( CAView::createWithColor( ccc4( 34 , 168 , 109 , 255 ) ) );
m_pMenuList->setTablePullUpView( CAImageView::createWithImage(CAImage::create("MenuDropList.png") ) );
m_pMenuList->setTablePullDownView( CAView::createWithColor( ccc4( 34 , 168 , 109 , 255 ) ) );
getView()->addSubview( m_pMenuList );
m_pMenuList->release();
m_pMenuList->setAllowsSelection( true );
CAImageView *pBk2 = CAImageView::createWithImage(CAImage::create("Bk2.png"));
pBk2->setFrame( CCRect( 0 , getView()->getFrame().size.height - 120 , getView()->getFrame().size.width , 120 ) );
getView()->addSubview( pBk2 );
m_pProgress = CAProgress::create();
m_pProgress->setFrame( CCRect( 0 , -40 , 720 , 44 ) );
//m_pProgress->setProgressTintColor( ccc4( 34 , 168 , 109 , 255 ) );
m_pProgress->setProgressTintColor( ccc4( 255 , 255 , 255 , 255 ) );
m_pProgress->setProgressTintImage( CAImage::create( "DownloadProgress.png" ) );
m_pProgress->setProgresstrackColor( ccc4( 74 , 103 , 92 , 255 ) );
m_pProgress->setVisible( false );
pBk2->addSubview( m_pProgress );
m_pProgressLabel = CALabel::createWithFrame( m_pProgress->getFrame() );
m_pProgressLabel->setColor( ccc4( 255 , 255 , 255 , 255 ) );
m_pProgressLabel->setFontSize( 28 );
m_pProgressLabel->setTextAlignment( CATextAlignmentCenter );
m_pProgressLabel->setVerticalTextAlignmet( CAVerticalTextAlignmentCenter );
pBk2->addSubview( m_pProgressLabel );
// 下载全书
{
CAButton *pButton = CAButton::createWithFrame( CCRect( 64 , 22 , 260 , 88 ) , CAButtonTypeCustom );
pButton->setBackGroundViewForState( CAControlStateNormal , CAScale9ImageView::createWithImage( CAImage::create( "ButtonNormal.png" ) ) );
pButton->setBackGroundViewForState( CAControlStateHighlighted , CAScale9ImageView::createWithImage( CAImage::create( "ButtonLight.png" ) ) );
pButton->setBackGroundViewForState( CAControlStateDisabled , CAScale9ImageView::createWithImage( CAImage::create( "ButtonDisable.png" ) ) );
CALabel *pLabel = CALabel::createWithFrame( CCRect( 0 , 0 , pButton->getFrame().size.width , pButton->getFrame().size.height ) );
pLabel->setText( ("下载全书") );
pLabel->setColor( ccc4( 255 , 255 , 255 , 255 ) );
pLabel->setFontSize( 28 );
pLabel->setTextAlignment( CATextAlignmentCenter );
pLabel->setVerticalTextAlignmet( CAVerticalTextAlignmentCenter );
pButton->addSubview( pLabel );
pBk2->addSubview( pButton );
pButton->addTarget( this , CAControl_selector(PageMenu::OnDownloadAllButtonDown) , CAControlTouchUpInSide );
}
// 章节下载
{
CAButton *pButton = CAButton::createWithFrame( CCRect( 400 , 22 , 260 , 88 ) , CAButtonTypeCustom );
pButton->setBackGroundViewForState( CAControlStateNormal , CAScale9ImageView::createWithImage( CAImage::create( "ButtonNormal.png" ) ) );
pButton->setBackGroundViewForState( CAControlStateHighlighted , CAScale9ImageView::createWithImage( CAImage::create( "ButtonLight.png" ) ) );
pButton->setBackGroundViewForState( CAControlStateDisabled , CAScale9ImageView::createWithImage( CAImage::create( "ButtonDisable.png" ) ) );
CALabel *pLabel = CALabel::createWithFrame( CCRect( 0 , 0 , pButton->getFrame().size.width , pButton->getFrame().size.height ) );
pLabel->setText( ("下载后续章节") );
pLabel->setColor( ccc4( 255 , 255 , 255 , 255 ) );
pLabel->setFontSize( 28 );
pLabel->setTextAlignment( CATextAlignmentCenter );
pLabel->setVerticalTextAlignmet( CAVerticalTextAlignmentCenter );
pButton->addSubview( pLabel );
pBk2->addSubview( pButton );
pButton->addTarget( this , CAControl_selector(PageMenu::OnDownloadButtonDown) , CAControlTouchUpInSide );
}
ShowWait( true );
BookDB::Instance()->GetBookMenu( &m_bookData , this , BookDB_selector(PageMenu::OnComplete) );
}
示例7: buildCtrlViews
void CAVideoPlayerControlView::buildCtrlViews()
{
m_glView = CAVideoPlayerView::createWithFrame(getFrame());
m_glView->setFrameOrigin(DPointZero);
m_glView->setColor(ccc4(0, 0, 0, 0));
this->insertSubview(m_glView, 1);
// Bottom Panel Back
CAImageView* bottomPanel = NULL;
do {
DRect frame = m_glView->getFrame();
CAImage* image = CAImage::create("source_material/vdo_panel_bottom_bg.png");
float width = m_glView->getFrame().size.width;
float height = image->getContentSize().height;
bottomPanel = CAImageView::createWithFrame(DRect(0, frame.size.height - height, width, height));
bottomPanel->setImage(image);
m_glView->addSubview(bottomPanel);
} while (0);
// Slider
do {
DRect frame = bottomPanel->getFrame();
CAImage* backImage = CAImage::create("source_material/vdo_progress_back.png");
CAImage* barImage = CAImage::create("source_material/vdo_progress_bar.png");
m_playSlider = CASlider::createWithCenter(DRect(frame.size.width / 2, frame.size.height*0.3, frame.size.width * 0.9, barImage->getContentSize().height));
m_playSlider->setMaxTrackTintImage(backImage);
m_playSlider->setThumbTintImage(barImage);
m_playSlider->setTrackHeight(backImage->getContentSize().height);
m_playSlider->addTargetForTouchUpSide(this, CAControl_selector(CAVideoPlayerControlView::onSlideChanged));
m_playSlider->addTarget(this, CAControl_selector(CAVideoPlayerControlView::onSlideTouched));
bottomPanel->addSubview(m_playSlider);
} while (0);
// Play Pause Button
do {
DRect frame = bottomPanel->getFrame();
CAImage* backImage = CAImage::create("source_material/vdo_pause.png");
CAImage* backImage_h = CAImage::create("source_material/vdo_pause_down.png");
frame.origin.y = frame.size.height * 2 / 3;
frame.origin.x = backImage->getContentSize().width;
frame.size.height = backImage->getContentSize().height;
frame.size.width = backImage->getContentSize().width;
m_playButton = CAButton::createWithCenter(frame, CAButtonTypeCustom);
m_playButton->setImageForState(CAControlStateAll, backImage);
m_playButton->setImageForState(CAControlStateHighlighted, backImage_h);
m_playButton->addTarget(this, CAControl_selector(CAVideoPlayerControlView::onButtonPause), CAControlEventTouchUpInSide);
bottomPanel->addSubview(m_playButton);
} while (0);
// play time
do {
DRect frame = m_playButton->getFrame();
DRect newFrame = DRectZero;
m_playTimeLabel = CALabel::createWithFrame(DRectZero);
m_playTimeLabel->setFontSize(32);
m_playTimeLabel->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
m_playTimeLabel->setColor(ccc4(255, 255, 255, 255));
newFrame.origin.x = frame.origin.x * 2 + frame.size.width;
newFrame.origin.y = frame.origin.y;
newFrame.size.width = m_playTimeLabel->getFontSize() * 20;
newFrame.size.height = frame.size.height;
m_playTimeLabel->setFrame(newFrame);
m_playTimeLabel->setText("00:00 / 00:00");
bottomPanel->addSubview(m_playTimeLabel);
} while (0);
// Top Panel Back
CAImageView* topPanel = NULL;
do {
CAImage* image = CAImage::create("source_material/vdo_panel_top_bg.png");
topPanel = CAImageView::createWithFrame(DRect(0, 0, m_glView->getFrame().size.width, image->getContentSize().height));
topPanel->setImage(image);
m_glView->addSubview(topPanel);
} while (0);
// Back Button
CAButton* buttonBack = NULL;
do {
DRect frame = topPanel->getFrame();
// CAImage* backImage = CAImage::create("source_material/vdo_btn_back.png");
// CAImage* backImage_h = CAImage::create("source_material/vdo_btn_back_h.png");
CAImage* backImage = CAImage::create("source_material/btn_left_blue.png");
CAImage* backImage_h = CAImage::create("source_material/btn_left_white.png");
frame.origin.y = frame.size.height / 3;
frame.origin.x = frame.origin.y;
frame.size.height = backImage->getContentSize().height;
frame.size.width = backImage->getContentSize().width;
buttonBack = CAButton::createWithCenter(frame, CAButtonTypeCustom);
buttonBack->setImageForState(CAControlStateAll, backImage);
buttonBack->setImageForState(CAControlStateHighlighted, backImage_h);
buttonBack->addTarget(this, CAControl_selector(CAVideoPlayerControlView::onButtonBack), CAControlEventTouchUpInSide);
topPanel->addSubview(buttonBack);
} while (0);
// Title
do {
DRect frame = buttonBack->getFrame();
DRect r = DRectZero;
r.origin.x = buttonBack->getFrame().origin.x * 2 + buttonBack->getFrame().size.width;
r.origin.y = buttonBack->getFrame().origin.y;
//.........这里部分代码省略.........
示例8: initWithReuseIdentifier
bool HeroInfoControllerCell::initWithReuseIdentifier(const std::string& reuseIdentifier, const CCSize& cellSize, const HeroInfo* info){
if (!CATableViewCell::initWithReuseIdentifier(reuseIdentifier))
{
return false;
}
if (reuseIdentifier == "fristSection"){
CCRect fristRect;
fristRect.size.width = (cellSize.width - _px(50) )/ 4;
fristRect.size.height = cellSize.height - _px(20);
fristRect.origin.x = _px(10) + fristRect.size.width / 2;
fristRect.origin.y = cellSize.height / 2;
CAView* _view1 = CAView::createWithCenter(fristRect);
this->addSubview(_view1);
char overly[10];
sprintf(overly, "%d", info->useTime);
CALabel* m_pLabel1 = CALabel::createWithFrame(CCRect(_px(0), _px(0), fristRect.size.width, fristRect.size.height / 2));
m_pLabel1->setColor(CAColor_black);
m_pLabel1->setFontSize(_px(20));
m_pLabel1->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
m_pLabel1->setTextAlignment(CATextAlignmentCenter);
m_pLabel1->setText((overly + UTF8ToGBK::transferToGbk("万")));
_view1->addSubview(m_pLabel1);
CALabel* m_pLabel1_v = CALabel::createWithFrame(CCRect(0, fristRect.origin.y / 2, fristRect.size.width, fristRect.size.height / 2));
m_pLabel1_v->setColor(CAColor_gray);
m_pLabel1_v->setFontSize(_px(15));
m_pLabel1_v->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
m_pLabel1_v->setTextAlignment(CATextAlignmentCenter);
m_pLabel1_v->setText(UTF8("本月场次"));
_view1->addSubview(m_pLabel1_v);
fristRect.origin.x += fristRect.size.width + _px(10);
CAView* _view2 = CAView::createWithCenter(fristRect);
this->addSubview(_view2);
CALabel* m_pLabel2 = CALabel::createWithFrame(CCRect(0, 0, fristRect.size.width, fristRect.size.height / 2));
m_pLabel2->setColor(CAColor_black);
m_pLabel2->setFontSize(_px(20));
m_pLabel2->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
m_pLabel2->setTextAlignment(CATextAlignmentCenter);
m_pLabel2->setText(UTF8ToGBK::transferToGbk("60"));
_view2->addSubview(m_pLabel2);
CALabel* m_pLabel2_v = CALabel::createWithFrame(CCRect(0, fristRect.origin.y / 2, fristRect.size.width, fristRect.size.height / 2));
m_pLabel2_v->setColor(CAColor_gray);
m_pLabel2_v->setFontSize(_px(15));
m_pLabel2_v->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
m_pLabel2_v->setTextAlignment(CATextAlignmentCenter);
m_pLabel2_v->setText(UTF8("场次排名"));
_view2->addSubview(m_pLabel2_v);
fristRect.origin.x += fristRect.size.width + _px(10);
CAView* _view3 = CAView::createWithCenter(fristRect);
this->addSubview(_view3);
char overly1[10];
sprintf(overly1, "%0.1f", info->winProb);
CALabel* m_pLabel3 = CALabel::createWithFrame(CCRect(0, 0, fristRect.size.width, fristRect.size.height / 2));
m_pLabel3->setColor(CAColor_black);
m_pLabel3->setFontSize(_px(20));
m_pLabel3->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
m_pLabel3->setTextAlignment(CATextAlignmentCenter);
m_pLabel3->setText(UTF8ToGBK::transferToGbk(overly1));
_view3->addSubview(m_pLabel3);
CALabel* m_pLabel3_v = CALabel::createWithFrame(CCRect(0, fristRect.origin.y / 2, fristRect.size.width, fristRect.size.height / 2));
m_pLabel3_v->setColor(CAColor_gray);
m_pLabel3_v->setFontSize(_px(15));
m_pLabel3_v->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
m_pLabel3_v->setTextAlignment(CATextAlignmentCenter);
m_pLabel3_v->setText(UTF8("本月胜率"));
_view3->addSubview(m_pLabel3_v);
fristRect.origin.x += fristRect.size.width + _px(10);
CAView* _view4 = CAView::createWithCenter(fristRect);
this->addSubview(_view4);
CALabel* m_pLabel4 = CALabel::createWithFrame(CCRect(0, 0, fristRect.size.width, fristRect.size.height / 2));
m_pLabel4->setColor(CAColor_black);
m_pLabel4->setFontSize(_px(20));
m_pLabel4->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
m_pLabel4->setTextAlignment(CATextAlignmentCenter);
m_pLabel4->setText("3");
_view4->addSubview(m_pLabel4);
CALabel* m_pLabel4_v = CALabel::createWithFrame(CCRect(0, fristRect.origin.y / 2, fristRect.size.width, fristRect.size.height / 2));
m_pLabel4_v->setColor(CAColor_gray);
m_pLabel4_v->setFontSize(_px(15));
m_pLabel4_v->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
m_pLabel4_v->setTextAlignment(CATextAlignmentCenter);
m_pLabel4_v->setText(UTF8("胜率排名"));
_view4->addSubview(m_pLabel4_v);
}
//.........这里部分代码省略.........
示例9: tableViewSectionViewForHeaderInSection
CAView* HeroViewController::tableViewSectionViewForHeaderInSection(CATableView* table, const CCSize& viewSize, unsigned int section)
{
if (section ==0)
{
return NULL;
}
m_pClassView = CAView::createWithColor(COLOR_GRAY);
CALabel* label = CALabel::createWithFrame(CCRect(10,0,viewSize.width/10,viewSize.height));
label->setTextAlignment(CATextAlignmentLeft);
label->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
label->setText(UTF8("本地数据"));
label->setFontSize(_px(13));
m_pClassView->addSubview(label);
// m_pSegmented = CASegmentedControl::createWithFrame(CCRect(viewSize.width/10*6,_px(0),viewSize.width/10*3,viewSize.height/2),4);
// //m_pSegmented->setSegmentItemBackgroundImage()
// //m_pSegmented->setContentOffsetForSegmentAtIndex()
//
// m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/All_Class.png"), 0, CAControlStateNormal);
// m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/All_Class1.png"), 0, CAControlStateSelected);
// m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/Power_Class.png"), 1, CAControlStateNormal);
// m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/Power_Class1.png"), 1, CAControlStateSelected);
// m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/Agile_Class.png"), 2, CAControlStateNormal);
// m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/Agile_Class1.png"), 2, CAControlStateSelected);
// m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/Puzzle_Class.png"), 3, CAControlStateNormal);
// m_pSegmented->setImageForSegmentAtIndex(CAImage::create("hero/Puzzle_Class1.png"), 3, CAControlStateSelected);
// m_pSegmented->setBackgroundView(CAView::createWithColor(COLOR_GRAY));
// m_pSegmented->setBackgroundImage(NULL);
// m_pSegmented->setSelectedAtIndex(0);
//
// //m_pSegmented->addTarget()
// m_pClassView->addSubview(m_pSegmented);
CAVector<CATabBarItem*> items;
CATabBarItem* tabBarItem1 = CATabBarItem::create("", CAImage::create("hero/All_Class.png"),
CAImage::create("hero/All_Class1.png"));
CATabBarItem* tabBarItem2 = CATabBarItem::create("", CAImage::create("hero/Power_Class.png"),
CAImage::create("hero/Power_Class1.png"));
CATabBarItem* tabBarItem3 = CATabBarItem::create("", CAImage::create("hero/Agile_Class.png"),
CAImage::create("hero/Agile_Class1.png"));
CATabBarItem* tabBarItem4 = CATabBarItem::create("", CAImage::create("hero/Puzzle_Class.png"),
CAImage::create("hero/Puzzle_Class1.png"));
items.pushBack(tabBarItem1);
items.pushBack(tabBarItem2);
items.pushBack(tabBarItem3);
items.pushBack(tabBarItem4);
m_pClassTabBar = CATabBar::create(items, CCSize(160, 40));
m_pClassTabBar->setTag(101);
m_pClassTabBar->setSelectedAtIndex(selectNum);
m_pClassTabBar->setBackGroundColor(COLOR_GRAY);
m_pClassTabBar->setSelectedBackGroundColor(COLOR_GRAY);
m_pClassTabBar->setDelegate(this);
m_pClassTabBar->setCenterOrigin(CCPoint(viewSize.width / 10 * 8, _px(viewSize.height / 2)));
m_pClassView->addSubview(m_pClassTabBar);
return m_pClassView;
}
示例10: 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;
}