2011-12-24 8 views
0

ここに示すコードがあります。キーボードがcocos2dにuitextfieldを表示しない

UIViewController* viewControoler = [[UIViewController alloc]init]; 
textfield = [[UITextField alloc]initWithFrame:CGRectMake(0,0,280,90)]; 
textfield.placeholder = @"word"; 
textfield.keyboardType = UIKeyboardTypeDefault; 
textfield.returnKeyType = UIReturnKeySearch; 
textfield.clearButtonMode = UITextFieldViewModeWhileEditing; 
textfield.delegate = self; 
textfield.userInteractionEnabled = YES; 
[textfield becomeFirstResponder]; 
[viewControoler.view addSubview:textfield]; 
[[[CCDirector sharedDirector]openGLView] addSubview:viewControoler.view]; 

正常に動作しています。しかし、テキストフィールドは、uitextfiledをクリックしてもキーボードが来ないので編集できません。

答えて

1

のUIViewControllerを外し、直接OpenGLViewに追加し、

textfield = [[UITextField alloc]initWithFrame:CGRectMake(0,0,280,90)]; 
textfield.placeholder = @"word"; 
textfield.keyboardType = UIKeyboardTypeDefault; 
textfield.returnKeyType = UIReturnKeySearch; 
textfield.clearButtonMode = UITextFieldViewModeWhileEditing; 
textfield.delegate = self; 
textfield.userInteractionEnabled = YES; 
[textfield becomeFirstResponder]; 

[[[CCDirector sharedDirector]openGLView] addSubview:textfield; 
関連する問題