I have the following code that adds a text entry field to the current layer and opens the keyboard:
CCSize size = CCDirector::sharedDirector()>getWinSize;>setPosition(ccp(size.width/2, size.height*0.8));
CCTextFieldTTF* nameEntryField = CCTextFieldTTF::textFieldWithPlaceHolder,
CCTextAlignmentLeft, “Menlo”, size.height/12);
nameEntryField
this~~>addChild;
nameEntryField~~>attachWithIME();
I have tested this on the iPhone simulator on XCode and on my iPad 2 and in both cases, when I type the first character it shows up in the text field like expected, but subsequent characters show up in the same place, i.e. over the first character(s).
P.S: When the above code is called I get the message “Cocos2d: markedTextRange” in the console three times. This message is also printed for every key press.
What am I doing wrong? Do I need to “move the cursor” myself somehow?