本文整理汇总了C++中CAScale9ImageView::setImage方法的典型用法代码示例。如果您正苦于以下问题:C++ CAScale9ImageView::setImage方法的具体用法?C++ CAScale9ImageView::setImage怎么用?C++ CAScale9ImageView::setImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAScale9ImageView
的用法示例。
在下文中一共展示了CAScale9ImageView::setImage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTailorImageAtIndex
CAView* CAStepper::getTailorImageAtIndex(int i)
{
CAImageView* imageView = NULL;
CAScale9ImageView* clipNode = CAScale9ImageView::createWithFrame(m_pBackgroundImageView->getBounds());
clipNode->setImage(m_pBackgroundImage[CAControlStateHighlighted]);
DSize size = clipNode->getFrame().size;
CARenderImage* render = CARenderImage::create(size.width, size.height);
render->printscreenWithView(clipNode);
DRect rect;
if (m_pCAStepperOrientation==CAStepperOrientationHorizontal) {
rect.origin = DPoint(i*m_pBackgroundImageView->getBounds().size.width/2,0);
rect.size = DSize(m_pBackgroundImageView->getBounds().size.width/2,m_pBackgroundImageView->getBounds().size.height);
}else{
rect.origin = DPoint(0,i*m_pBackgroundImageView->getBounds().size.height/2);
rect.size = DSize(m_pBackgroundImageView->getBounds().size.width,m_pBackgroundImageView->getBounds().size.height/2);
}
imageView = CAImageView::createWithImage(render->getImageView()->getImage());
imageView->setFrame(rect);
imageView->setImageRect(rect);
return imageView;
}
示例2: 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;
}
示例3: show
void CATextToolBarView::show(CAView* pView)
{
CCSize winSize = CAApplication::getApplication()->getWinSize();
float alertViewButtonHeight = 88;
float alertViewWidth = winSize.width * 2 / 3;
CCRect rect = CCRect(winSize.width / 2, winSize.height / 2 - alertViewButtonHeight, alertViewWidth, alertViewButtonHeight);
m_pBackView = CAClippingView::create();
m_pBackView->setCenter(rect);
this->addSubview(m_pBackView);
this->setTextTag("CATextToolBarView");
m_pBackView->setAlphaThreshold(0.5f);
CAScale9ImageView *backgroundImageView = CAScale9ImageView::createWithFrame(m_pBackView->getBounds());
backgroundImageView->setImage(CAImage::create("source_material/alert_back.png"));
m_pBackView->addSubview(backgroundImageView);
m_pBackView->setStencil(backgroundImageView->copy());
size_t btnCount = m_CallbackTargets.size();
for (int i = 0; i < btnCount; i++)
{
CAButton* btn = CAButton::create(CAButtonTypeSquareRect);
btn->setTitleForState(CAControlStateAll, m_CallbackTargets[i].cszButtonText.c_str());
btn->setTitleColorForState(CAControlStateAll, ccc4(3, 100, 255, 255));
btn->setBackGroundViewForState(CAControlStateNormal, CAView::createWithColor(CAColor_clear));
btn->setBackGroundViewForState(CAControlStateHighlighted, CAView::createWithColor(ccc4(226, 226, 226, 225)));
btn->setTag(i);
btn->addTarget(this, CAControl_selector(CATextToolBarView::alertViewCallback), CAControlEventTouchUpInSide);
btn->setFrame(CCRect(i*alertViewWidth / btnCount, 0, alertViewWidth / btnCount, alertViewButtonHeight));
m_pBackView->addSubview(btn);
if (i>0)
{
addGrayLine(alertViewWidth/btnCount * i);
}
}
if (CAWindow *rootWindow = CAApplication::getApplication()->getRootWindow())
{
rootWindow->insertSubview(this, CAWindowZOderTop);
}
becomeFirstResponder();
m_pControlView = pView;
}
示例4: initWithCell
void FSNewsAboutTableCell::initWithCell()
{
CADipSize m_size = this->getFrame().size;
CALabel* cellText = CALabel::createWithCenter(CADipRect(m_size.width/2+40, m_size.height/2, m_size.width, 40));
cellText->setTag(100);
cellText->setFontSize(_px(30));
cellText->setTextAlignment(CATextAlignmentLeft);
cellText->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
this->addSubview(cellText);
CAScale9ImageView* iv = CAScale9ImageView::createWithCenter(CADipRect(m_size.width-50,m_size.height/2,50,50));
iv->setImage(CAImage::create("source_material/cell_btn_right.png"));
iv->setTag(101);
this->addSubview(iv);
CASwitch* sw = CASwitch::createWithCenter(CADipRect(m_size.width-90, m_size.height/2, 100, 50));
sw->setTag(103);
sw->setVisible(false);
this->addSubview(sw);
}
示例5: initWithReuseIdentifier
bool HeroViewControllerCell::initWithReuseIdentifier(const std::string& reuseIdentifier, const CCSize& cellSize, const HeroInfo* info){
if (!CATableViewCell::initWithReuseIdentifier(reuseIdentifier))
{
return false;
}
if (reuseIdentifier =="top")
{
CALabel* m_pLabel1 = CALabel::createWithFrame(CCRect(0, 0, cellSize.width /10, cellSize.height));
m_pLabel1->setColor(CAColor_gray);
m_pLabel1->setFontSize(_px(15));
m_pLabel1->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
m_pLabel1->setTextAlignment(CATextAlignmentCenter);
m_pLabel1->setText(UTF8("英雄"));
this->addSubview(m_pLabel1);
CALabel* m_pLabel2 = CALabel::createWithFrame(CCRect(cellSize.width / 3, 0, cellSize.width / 10*5, cellSize.height));
m_pLabel2->setColor(CAColor_gray);
m_pLabel2->setFontSize(_px(15));
m_pLabel2->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
m_pLabel2->setTextAlignment(CATextAlignmentLeft);
m_pLabel2->setText(UTF8("胜率"));
this->addSubview(m_pLabel2);
CALabel* m_pLabel3 = CALabel::createWithFrame(CCRect(cellSize.width / 10 *8, 0, cellSize.width/10*2 , cellSize.height ));
m_pLabel3->setColor(CAColor_gray);
m_pLabel3->setFontSize(_px(15));
m_pLabel3->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
m_pLabel3->setTextAlignment(CATextAlignmentCenter);
m_pLabel3->setText(UTF8("场次"));
this->addSubview(m_pLabel3);
return true;
}
m_pImageData = CAImageView::createWithCenter(CCRect(40, cellSize.height / 2, cellSize.height - _px(10), cellSize.height - _px(10)));
m_pImageData->setImage(CAImage::create(info->heroIMG));
this->addSubview(m_pImageData);
char s0[10];
m_pLabel1 = CALabel::createWithFrame(CCRect(_px(70), 0, cellSize.width / 2, cellSize.height));
m_pLabel1->setColor(CAColor_black);
m_pLabel1->setFontSize(_px(15));
m_pLabel1->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
m_pLabel1->setTextAlignment(CATextAlignmentLeft);
m_pLabel1->setText(UTF8ToGBK::transferToGbk(info->heroName));
this->addSubview(m_pLabel1);
char s[10];
sprintf(s,"%0.1f%",info->winProb);
m_pLabel2 = CALabel::createWithFrame(CCRect(CCRect(cellSize.width / 10*3, 0, cellSize.width / 10 * 5, cellSize.height/2)));
m_pLabel2->setColor(CAColor_black);
m_pLabel2->setFontSize(_px(15));
/*m_pLabel1->setLineSpacing(5);*/
m_pLabel2->setVerticalTextAlignmet(CAVerticalTextAlignmentBottom);
m_pLabel2->setTextAlignment(CATextAlignmentLeft);
m_pLabel2->setText(s);
this->addSubview(m_pLabel2);
CAScale9ImageView* bgPic = CAScale9ImageView::createWithFrame(CCRect(cellSize.width / 10 * 3, cellSize.height / 2+_px(10), cellSize.width / 10*5, 5));
bgPic->setImage(CAImage::create("source_material/page_b.png"));
this->addSubview(bgPic);
CAScale9ImageView* fgPic = CAScale9ImageView::createWithFrame(CCRect(cellSize.width / 10 * 3, cellSize.height / 2 + _px(10), cellSize.width / 2 / 100 * info->winProb, 5));
fgPic->setImage(CAImage::create("source_material/page_h.png"));
this->addSubview(fgPic);
char s1[10];
sprintf(s1, UTF8("%d万"), info->useTime);
m_pLabel1 = CALabel::createWithFrame(CCRect(cellSize.width / 10 *8, 0, cellSize.width/5, cellSize.height));
m_pLabel1->setColor(CAColor_gray);
m_pLabel1->setFontSize(_px(15));
m_pLabel1->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
m_pLabel1->setTextAlignment(CATextAlignmentCenter);
m_pLabel1->setText(s1);
this->addSubview(m_pLabel1);
return true;
}