开发者

iPhone Cocos2d Game Menu Text Entry or Text Field

开发者 https://www.devze.com 2023-03-24 09:16 出处:网络
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 wou

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

精彩评论

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