CCLablettf读取显示xml文件内容显示中文

  1. CCDictionary *strings = CCDictionary::createWithContentsOfFile("tips2.xml");
  2. const char *hello = ((CCString*)strings->valueForKey("tp1"))->m_sString.c_str();
  3. CCLabelTTF *labelHello = CCLabelTTF::create(hello, "fonts/Microsoft YaHei.ttf", 40);
  4. labelHello->setPosition(ccp(100, 100));
  5. labelHello->setAnchorPoint(ccp(0.5, 0.5));
  6. //设置居中对齐
  7. labelHello->setHorizontalAlignment(kCCTextAlignmentLeft);
  8. labelHello->setPosition(ccp(267,182));
  9. //设置显示框大小
  10. labelHello->setDimensions(CCSizeMake(500, 200));
  11. labelHello->setColor(ccc3(6, 48, 90));
  12. pReliveBoard->addChild(labelHello, 1);





posted @ 2017-01-09 11:18  feizuzu  阅读(269)  评论(0编辑  收藏  举报