码迷,mamicode.com
首页 > 其他好文 > 详细

cocos2d-x CCDictionary的遍历

时间:2014-11-21 15:47:35      阅读:271      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   ar   os   sp   for   on   

CCDictionary的遍历不是用for或foreach,而是cocos2d-x自己封装了一个遍历方法CCDICT_FOREACH(__dict__, __el__)

用法:

CCDictionary * pDict = CCDictionary::create();

pDict->setObject(CCString::create("value1"), "key1");

pDict->setObject(CCString::create("value2"), "key2");

CCDictElement * pElement;

CCDICT_FOREACH(pDict, pElement)

{

const char * key = pElement->getStrKey();

CCString * value = (CCString *)pElement->getObject();

CCLog(key);

CCLog(value ->getCString());

}

bubuko.com,布布扣

cocos2d-x CCDictionary的遍历

标签:style   blog   http   io   ar   os   sp   for   on   

原文地址:http://www.cnblogs.com/C-Plus-Plus/p/4112912.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!