本文整理汇总了C++中ImageView::getChildByTag方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageView::getChildByTag方法的具体用法?C++ ImageView::getChildByTag怎么用?C++ ImageView::getChildByTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageView
的用法示例。
在下文中一共展示了ImageView::getChildByTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onHttpLoadImageCompleted
void GameWin::onHttpLoadImageCompleted(HttpClient *sender, HttpResponse *response){
if (!response)
{
return;
}
// You can get original request type from: response->request->reqType
if (0 != strlen(response->getHttpRequest()->getTag()))
{
log("%s completed", response->getHttpRequest()->getTag());
}
int statusCode = response->getResponseCode();
char statusString[64] = {};
sprintf(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag());
// _labelStatusCode->setString(statusString);
log("response code: %d", statusCode);
if (!response->isSucceed())
{
log("response failed");
log("error buffer: %s", response->getErrorBuffer());
return;
}
if (statusCode != 200){
log("response code failed");
log("error buffer: %s", response->getErrorBuffer());
//SaveReward2Local();
return;
}
// dump data
std::vector<char> *buffer = response->getResponseData();
Image* image = new Image();
image->initWithImageData(reinterpret_cast<unsigned char*>(&(buffer->front())), buffer->size());
Texture2D* texture = new Texture2D();
texture->initWithImage(image);
if(_rootNode && _rootNode->getChildByName("ivPromotionImg")){
ImageView* imgPromotion = dynamic_cast<ImageView*>(_rootNode->getChildByName("ivPromotionImg"));
Sprite* sprite = (Sprite*)imgPromotion->getChildByTag(1001);
sprite->setTexture(texture);
}
if(_rootNode && _rootNode->getChildByName("lblProductName")){
Text* lblProductName=dynamic_cast<Text*>(_rootNode->getChildByName("lblProductName"));// (CCLabelTTF*)this->getChildByTag(2001);
lblProductName->setString(m_strProductName);
}
}