Cocos2d iphone Cocos2D中的UITextField
我已经用我的CCLayer的“init”方法编写了以下代码: 为什么UITextField不可见Cocos2d iphone Cocos2D中的UITextField,cocos2d-iphone,uitextfield,Cocos2d Iphone,Uitextfield,我已经用我的CCLayer的“init”方法编写了以下代码: 为什么UITextField不可见 不知道CCUIWrapper是怎么回事,但您现在可能想尝试CCTextField而不是这种方法 尝试设置UITextField的.preferredsize 尝试使用UITextField的initWithFrame:method而不是简单的init。。。无…UITextField*tf=[[UITextField alloc]initWithFrame:CGRectMake(0,0,150,30)
尝试使用UITextField的initWithFrame:method而不是简单的init。。。无…UITextField*tf=[[UITextField alloc]initWithFrame:CGRectMake(0,0,150,30)]自动释放];CCUIWrapper*tfwrapper=[CCUIWrapper-wrapperforui:tf];tfwrapper.anchorPoint=ccp(0,0);tfwrapper.position=ccp(0,0);[self addChild:tfwrapper];
//textField
UITextField *tf = [[[UITextField alloc] init] autorelease];
tf.borderStyle = UITextBorderStyleRoundedRect;
CCUIWrapper *tfwrapper = [CCUIWrapper wrapperForUIView:tf];
tfwrapper.anchorPoint = ccp(0, 0);
tfwrapper.contentSize = CGSizeMake(100, 20);
tfwrapper.position = ccp(100, 100);
[self addChild:tfwrapper];