[ solved ] CCLabelTTF With NSString and Array


#1

Hi guys, I’m working on a Word based game. It’s like alphatbet arranged on a board like spelltower/wordfued.
So I/ve trying to create an array of NSString type… since CCLabelTTF accepts onlu NSString.But I getting error
" Undefined type NSString “…
What to do… :frowning:

I tried this way : NSString l[]={”A“,”A“,”A"};

Is that the right way… I’m new to ios development and cocos2d-x… :stuck_out_tongue:

Solution :

Check this :

Now I’ve created array string like


std::string letters[4]={“A”,“B”,“C”,“D”];

for(int i=0;<4;i++)
{
std::string str = new std::string ;
CCLabelTTF
letter = CCLabelTTF::labelWithString ( str->c_str() , " ArialRoundedMTBold " , 25 ) ;
}


DONE! :smiley: