1. 首页
  2. 移动开发
  3. iOS
  4. HttpClient动态加载网络图片

HttpClient动态加载网络图片

上传者: 2019-01-02 13:08:14上传 ZIP文件 2.63KB 热度 40次
//加载一个网络图片 WebSprite* webimg = WebSpriteAgentInst->createWebSprite("hello","url.png"); this->addChild(webimg); webimg->setPosition(visibleSize/2); 可能需要 #ifndef __SINGLETON_H__ #define __SINGLETON_H__ #include "cocos2d.h" template class CoaSingleton { public: static T* getInstance(); static void releaseInstance(); protected: CoaSingleton(void); ~CoaSingleton(void); private: static T* s_pInstance; }; template CoaSin gleton::CoaSingleton(void) { }; template CoaSingleton::~CoaSingleton(void) { }; template inline T* CoaSingleton::getInstance() { if(!s_pInstance) { s_pInstance = new T; } return s_pInstance; } template void CoaSingleton::releaseInstance(){ if(!s_pInstance) { return; } delete s_pInstance; s_pInstance = NULL; } template T* CoaSingleton::s_pInstance = NULL; #endif //__SINGLETON_H__ gleton::CoaSingleton(void) { }; template CoaSingleton::~CoaSingleton(void) { }; template inline T* CoaSingleton::getInstance() { if(!s_pInstance) { s_pInstance = new T; } return s_pInstance; } template void CoaSingleton::releaseInstance(){ if(!s_pInstance) { return; } delete s_pInstance; s_pInstance = NULL; } template T* CoaSingleton::s_pInstance = NULL; #endif //__SINGLETON_H__
用户评论