本文整理汇总了C++中CAImageView类的典型用法代码示例。如果您正苦于以下问题:C++ CAImageView类的具体用法?C++ CAImageView怎么用?C++ CAImageView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CAImageView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onEnter
void CAPageControl::onEnter()
{
CAControl::onEnter();
if (m_pIndicators.size() != m_numberOfPages) {
m_pIndicators.clear();
for (int i=0; i<m_numberOfPages; i++) {
CAImageView* view;
if (i == m_currentPage) {
view = CAImageView::createWithImage(m_pSelectPageImage);
view->setColor(m_currentPageIndicatorTintColor);
} else {
view = CAImageView::createWithImage(m_pPageImage);
view->setColor(m_pageIndicatorTintColor);
}
CCRect rect;
float width = getFrame().size.width/m_numberOfPages;
rect.origin.x = i * width + width/2;
rect.origin.y = getFrame().size.height/2;
view->setCenterOrigin(rect.origin);
addSubview(view);
m_pIndicators.pushBack(view);
}
}
}
示例2: DPoint
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;
}
示例3: 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;
}
示例4: 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());
}
示例5: 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);
}
示例6: 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);
}
示例7: 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);
}
示例8: CommonHttpJson_selector
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();
}
}
示例9: _px
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);
}
示例10: CCLog
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;
}
示例11: MIN
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));
}
}
示例12: Java_org_CrossApp_lib_CrossAppTextView_onByte
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);
}
示例13: CC_SAFE_RELEASE
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;
}
}
示例14: CAControl_selector
void SessionsViewController::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_search.png"));
imageView->setImageViewScaleType(CAImageViewScaleTypeFitImageXY);
button->setBackgroundViewForState(CAControlStateAll, imageView);
button->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
button->setTag(20);
this->getView()->addSubview(button);
FSegmentView* seg = FSegmentView::createWithFrame(DRect(m_winSize.width - 240, 45, 200, 50), 2);
seg->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
imageView = CAImageView::createWithImage(CAImage::create("common/nav_time.png"));
seg->setItemBackgroundImage(imageView, 0);
imageView = CAImageView::createWithImage(CAImage::create("common/nav_type.png"));
seg->setItemBackgroundImage(imageView, 1);
seg->setTag(200, 0);
seg->setTag(201, 1);
this->getView()->addSubview(seg);
m_navType = 0;
m_navTimeType = 0;
m_navFormatType = 0;
CALabel* label = CALabel::createWithCenter(DRect(m_winSize.width / 2, (75), m_winSize.width, (50)));
label->setTextAlignment(CATextAlignmentCenter);
label->setColor(CAColor_white);
label->setFontSize(SAP_TITLE_FONT_SIZE);
label->setText("Agenda");
label->setFontName(SAP_FONT_ARIAL);
sView->addSubview(label);
if (m_msg->empty())
{
requestMsg();
{
p_pLoading = CAActivityIndicatorView::createWithCenter(DRect(m_winSize.width / 2, m_winSize.height / 2, 50, 50));
this->getView()->insertSubview(p_pLoading, CAWindowZOderTop);
p_pLoading->setLoadingMinTime(0.5f);
p_pLoading->setTargetOnCancel(this, callfunc_selector(SessionsViewController::initMsgTableView));
}
}
else
{
initMsgTableView();
}
CCLog("%f", CAApplication::getApplication()->getWinSize().width);
}
示例15: CAImageView
CAImageView* CAImageView::createWithLayout(const CrossApp::DLayout &layout)
{
CAImageView * pRet = new CAImageView();
if (pRet && pRet->initWithLayout(layout))
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}