本文整理汇总了C++中CAImageView::setImage方法的典型用法代码示例。如果您正苦于以下问题:C++ CAImageView::setImage方法的具体用法?C++ CAImageView::setImage怎么用?C++ CAImageView::setImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAImageView
的用法示例。
在下文中一共展示了CAImageView::setImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateCurrentPageDisplay
void CAPageControl::updateCurrentPageDisplay()
{
for (int i=0; i<m_numberOfPages; i++) {
CAImageView* view = m_pIndicators.at(i);
if (i == m_currentPage) {
view->setImage(m_pSelectPageImage);
view->setColor(m_currentPageIndicatorTintColor);
} else {
view->setImage(m_pPageImage);
view->setColor(m_pageIndicatorTintColor);
}
}
updateDraw();
}
示例2: toast
void UtilManager::toast(string text, string image, bool isSmall) {
CAApplication::getApplication()->getRootWindow()->removeSubviewByTag(TOAST_VIEW_TAG);
CCSize winSize = CAApplication::getApplication()->getWinSize();
CAImageView *back = CAImageView::create();
if (isSmall == false) {
//CAView *back = CAView::createWithCenter(CCRect(winSize.width*0.5, winSize.height*0.5, _dip(winSize.width)*0.3, _dip(winSize.height)*0.3));
back->setCenter(CCRect(winSize.width*0.5, winSize.height*0.55, _px(120), _px(120)));
}
else {
back->setCenter(CCRect(winSize.width*0.5, winSize.height*0.4, _px(120), _px(120)));
}
back->setTag(TOAST_VIEW_TAG);
back->setImage(CAImage::create("image/scape_storage.png"));
//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.8), 100, 100));
//title->setText(UTF8ToGBK::transferToGbk(text));
//title->setFontName(getChineseFont());
title->setColor(CAColor_white);
title->setTextAlignment(CATextAlignmentCenter);
title->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
title->setFontSize(_px(22));
back->addSubview(title);
CAImageView *icon = CAImageView::create();
if (isSmall == false) {
//CAView *back = CAView::createWithCenter(CCRect(winSize.width*0.5, winSize.height*0.5, _dip(winSize.width)*0.3, _dip(winSize.height)*0.3));
icon->setCenter(CADipRect(_dip(back->getBounds().size.width*0.5), _dip(back->getBounds().size.height*0.4), 90 / 1.5, 68 / 1.5));
}
else {
icon->setCenter(CADipRect(_dip(back->getBounds().size.width*0.5), _dip(back->getBounds().size.height*0.4), 72 / 1.5, 72 / 1.5));
}
//CAImageView *icon = CAImageView::createWithCenter(CADipRect(_dip(back->getBounds().size.width*0.5),_dip(back->getBounds().size.height*0.4), 105/1.5, 95/1.5));
icon->setImage(CAImage::create(image));
back->addSubview(icon);
CAApplication::getApplication()->getRootWindow()->addSubview(back);
//CCLog("%s", get_date_now().c_str());
icon->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(0.3), CCFadeOut::create(TOAST_TIME / 2.0)));
back->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(0.3), CCFadeOut::create(TOAST_TIME)));
scheduleOnce(schedule_selector(UtilManager::removeToast), this, TOAST_TIME);
}
示例3: 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);
}
示例4: viewDidLoad
void DMCatalogController::viewDidLoad()
{
if (m_mvData.empty())
{
HTTP_URL::S_HTTP_URL s_http_url = HTTP_URL::get_HTTP_URL(HTTP_URL::HttpUrlTypeRecommend);
CommonHttpManager::getInstance()->send_post(s_http_url.url, s_http_url.key_value, this, CommonHttpJson_selector(DMCatalogController::onRequestFinished));
{
CCRect loadingRect = this->getView()->getBounds();
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->setColor(CAColor_white);
this->getView()->insertSubview(m_pLoading, CAWindowZoderTop);
m_pLoading->setTargetOnCancel(this, callfunc_selector(DMCatalogController::initWithCollectionView));
}
}
else
{
this->initWithCollectionView();
}
}
示例5: 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);
}
示例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: 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());
}
示例8: tableCellAtIndex
CATableViewCell* MenuViewController::tableCellAtIndex(CATableView* table, const DSize& cellSize, unsigned int section, unsigned int row)
{
DSize _size = cellSize;
CATableViewCell* cell = table->dequeueReusableCellWithIdentifier("CrossApp");
if (cell == NULL)
{
cell = CATableViewCell::create("CrossApp");
cell->setBackgroundView(NULL);
CALabel* test = CALabel::createWithCenter(DRect(_size.width/2+30,
_size.height/2,
_size.width,
_size.height));
test->setTextAlignment(CATextAlignmentLeft);
test->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
test->setFontSize(_px(32));
test->setColor(CAColor_white);
test->setTag(100);
cell->addSubview(test);
CAImageView* arrow = CAImageView::createWithCenter(DRect(_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;
}
示例9: 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;
}
示例10: 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));
}
}
示例11: free
JNIEXPORT void JNICALL Java_org_CrossApp_lib_CrossAppTextView_onByte(JNIEnv *env, jclass cls, jint key, jbyteArray buf, jint width, jint height)
{
unsigned char* data = (unsigned char*)malloc(sizeof(unsigned char) * width * height * 4);
env->GetByteArrayRegion(buf, 0, width * height * 4, (jbyte *)data);
CAImage* image = CAImage::createWithRawDataNoCache(data, CAImage::PixelFormat_RGBA8888, width, height);
CAImageView* imageView = (CAImageView*)(s_map[(int)key]->getSubviewByTextTag("textView"));
imageView->setImage(image);
imageView->setVisible(true);
free(data);
}
示例12: setStyle
void CAActivityIndicatorView::setStyle(CAActivityIndicatorViewStyle style)
{
m_style = style;
if (m_style != CAActivityIndicatorViewStyleImage)
{
this->removeSubview(m_pImageView);
CC_SAFE_RELEASE(m_pImageView);
this->removeSubview(m_pBackView);
CC_SAFE_RELEASE(m_pBackView);
DRect center = getBounds();
center.origin = center.size/2;
CAImage* image = NULL;
switch (m_style)
{
case CAActivityIndicatorViewStyleGray:
{
image = CAImage::create("source_material/loading_black.png");
center.size = DSize(40, 40);
}
break;
case CAActivityIndicatorViewStyleWhite:
{
image = CAImage::create("source_material/loading_write.png");
center.size = DSize(40, 40);
} break;
case CAActivityIndicatorViewStyleGrayLarge:
{
image = CAImage::create("source_material/loading_black.png");
center.size = DSize(68, 68);
}
break;
case CAActivityIndicatorViewStyleWhiteLarge:
{
image = CAImage::create("source_material/loading_write.png");
center.size = DSize(68, 68);
}
break;
default:
break;
}
setTimesOneCycle(m_nTimesOneCycle);
CAImageView* imageView = CAImageView::createWithCenter(center);
imageView->retain();
imageView->setImage(image);
this->insertSubview(imageView, 1);
m_pImageView = imageView;
}
}
示例13: initWithCollectionView
void DMCatalogController::initWithCollectionView()
{
CADipRect rect = this->getView()->getBounds();
m_uiItems = (unsigned int)(rect.size.width / 300);
m_uiItems = MIN(m_uiItems, 5);
m_uiItems = MAX(m_uiItems, 3);
m_pCollectionView = CACollectionView::createWithFrame(rect);
m_pCollectionView->setCollectionViewDataSource(this);
m_pCollectionView->setCollectionViewDelegate(this);
m_pCollectionView->setScrollViewDelegate(this);
CAPullToRefreshView* view = CAPullToRefreshView::create(CAPullToRefreshView::CAPullToRefreshTypeHeader);
m_pCollectionView->setHeaderRefreshView(view);
m_pCollectionView->setBackGroundColor(CAColor_clear);
this->getView()->addSubview(m_pCollectionView);
m_pCollectionView->setAllowsSelection(true);
m_pCollectionView->setHoriInterval(_px(30));
m_pCollectionView->setVertInterval(_px(10));
float width = this->getView()->getBounds().size.width;
m_pCollectionView->setCollectionHeaderHeight(width * 15/32.0f);
CAButton* bg = CAButton::createWithFrame(CADipRect(0, 0, rect.size.width, _dip(m_pCollectionView->getCollectionHeaderHeight())), CAButtonTypeCustom);
m_pHeaderImageView = CommonUrlImageView::createWithImage(NULL);
bg->setBackGroundViewForState(CAControlStateNormal, m_pHeaderImageView);
bg->addTarget(this, CAControl_selector(DMCatalogController::onButton), CAControlEventTouchUpInSide);
m_pCollectionView->setCollectionHeaderView(bg);
CADipRect headerRect = CADipRectZero;
headerRect.size = rect.size;
headerRect.size.height = 76;
headerRect.origin.y = _dip(m_pCollectionView->getCollectionHeaderHeight()) - 76;
CAImageView* imageView = CAImageView::createWithFrame(headerRect);
imageView->setImage(CAImage::create(title_bg_first));
bg->insertSubview(imageView,1);
headerRect.origin.x = 25;
headerRect.size.height -= 20;
headerRect.size.width -= headerRect.origin.x;
headerRect.origin.y = _dip(m_pCollectionView->getCollectionHeaderHeight()) - headerRect.size.height;
m_pHeaderLabel = CALabel::createWithFrame(headerRect);
m_pHeaderLabel->setFontSize(_px(28));
m_pHeaderLabel->setColor(CAColor_white);
m_pHeaderLabel->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
bg->insertSubview(m_pHeaderLabel,1);
if (!m_mvData[m_sTitle].empty())
{
const DMBriefInfo& info = m_mvData[m_sTitle].front();
m_pHeaderLabel->setText("《" + info.title + "》" + info.subtitle);
m_pHeaderImageView->setUrl(info.cover);
}
}
示例14: setMarginImageRight
void CATextField::setMarginImageRight(const DSize& imgSize, const std::string& filePath)
{
setMarginRight(imgSize.width);
CAImageView* ima = (CAImageView*)this->getSubviewByTag(1011);
if (!ima)
{
ima = CAImageView::create();
ima->setTag(1011);
this->addSubview(ima);
}
ima->setCenter(DRect(getBounds().size.width - imgSize.width / 2, getBounds().size.height / 2, imgSize.width, imgSize.height));
ima->setImage(CAImage::create(filePath));
}
示例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());
}