开发者

iPhone Cocos2d Game Menu Text Entry or Text Field

Working on my third Cocos2d iPhone game and running into problems trying to make a create new account textfield. I have a menu image and some text that need to be displayed. On top of this layer I would like a Textfield so that the user can type the name of their new account. Seems like it would be pretty simple. I have looked at every example I could find online and nothing seems to work. Here is the method that I need to create the textfield in:

-开发者_如何学Python(void) CreateNewAccount: (id) sender
{
[self removeChild:MainMenu cleanup:YES];
BG2 = [CCSprite spriteWithFile:@"WelcomeMenu.png"];
BG2.position = ccp(512, 384);
[self addChild:BG2 z:6];
[self removeChild:BG cleanup:YES];
NewNameText = [CCSprite spriteWithFile:@"NewName.png"];
NewNameText.position = ccp(512, 300);
[self addChild:NewNameText z:7];     
}

Thanks for any help you can provide!!!


It looks like your text field is actually a sprite? I would suggest creating an actual UITextField for your purposes.

See the following: UITextField Example in Cocos2d

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜