multiline CCLabelTTF


#1

when i load string from a stringNames.plist file (for example “dvfnsdk nvjsnk”) and then create CCLabelTTF from that string i see just one line “dvfnsdk nvjsnk” instead of “nvjsnk” under “dvfnsdk”.

to reproduce this you can add to your project stringNames.plist file that contains:

    strings
    
        tutor0str0
        dvfnsdk \n nvjsnk
        tutor0str1
        my string

and in your code you create CCLabelTTF:

    const char *pszPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("stringNames.plist");

    CCDictionary *localizedDict = CCDictionary::createWithContentsOfFileThreadSafe(pszPath);

    localizedStrings = (CCDictionary*)localizedDict->objectForKey("strings");

    const char *text = localizedStrings->valueForKey(string("tutor0str0"))->getCString();

    CCLabelTTF * label = CCLabelTTF::create(text, "Thonburi", 20);
            this->addChild(label, 40);
            label->setPosition(ccp(100, 100));

but when to create CCLabelTTF i use string created in my code all works fine:

            CCLabelTTF * label = CCLabelTTF::create("dvfnsdk \n nvjsnk", "Thonburi", 20);
            this->addChild(label, 40);
            label->setPosition(ccp(100, 100));

in the debugger i can see that inside “CCLabelTTF::create()” method is call “NSArray listItems = ;". And when i create string for my CCLabelTTF from.plist file,”listItems" array has only one item instead of 2 despite the “str” equal to “dvfnsdk nvjsnk”.

how to fix that to be able to load multiline strings for CCLabelTTF ?