- 論壇徽章:
- 11
|
本帖最后由 Susake_ 于 2014-11-02 15:37 編輯
之前好像討論過,以下是我試過的3種方法
1.試了用iconv,這個(gè)成功的在Win32上運(yùn)行,但在android上沒成功
2.然后網(wǎng)上說讀取xml的方法,整了一下,代碼是這樣但是還是亂碼
xml是- <dict>
- <key>1</key>
- <string>一十分十分十分</string>
- <key>2</key>
- <string>二</string>
- </dict>
復(fù)制代碼 ....讀取代碼是- CCDictionary *strings = CCDictionary::createWithContentsOfFile("feature.xml");
- std::string str = ((CCString*)strings->objectForKey("1"))->getCString();
- CCLabelTTF *labelHello = CCLabelTTF::create(str, "Arial", 24);
- labelHello->setPosition(300, 300);
- this->addChild(labelHello, 7);
復(fù)制代碼 3.直接使用UI編輯器的Lable,能夠成功顯示中文,但是卻不能修改其內(nèi)容
如果沒有理解錯(cuò)的話,Cocostudio的UI控件的text內(nèi)容應(yīng)該只能適用于手機(jī)上的小鍵盤的修改
加載部分代碼如下- //Text* _displayValueLabel;
- Layer* uiLayer = Layer::create();
- auto myLayout = dynamic_cast<ui::Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("feature/Feature_1.json"));
- uiLayer->addChild(myLayout);
- uiLayer->setPosition(250, 400);
- this->addChild(uiLayer, 2);
復(fù)制代碼 ---------------------------------------------
恩,就這些了!求解決辦法~ |
|