2012-12-03 26 views
0

我寫這段代碼在我CCLayer的 「初始化」 方法:的UITextField在cocos2d

//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]; 

爲什麼不可見的UITextField?

+0

嘗試使用initWithFrame:UITextField的方法而不是簡單的init。 – Morion

+0

同樣的事情...什麼都沒有... –

+0

你設置了什麼框架? – Morion

回答

0
  1. 不知道怎麼了CCUIWrapper,但你現在可能想嘗試CCTextField而不是這種方法。
  2. 嘗試設置UITextField的.preferredsize。