Клавиатура не показывает uitextfield в cocos2d - PullRequest
0 голосов
/ 24 декабря 2011

Вот код для показа.

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 Ответ

1 голос
/ 26 декабря 2011

Удалить 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;
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...