Using UITextView and UITextField in cocos2D, unable to appear magnifying glass?
If XIB way to add UITextField, automatically appear on the magnifying glass
The following is a test program
UITextView *Edit=[[[UITextView alloc] initWithFrame:CGRectMake(38.0f, 90.0f, 240.0f, 150.0f)] autorelease];
[[[[Director sharedDirector] openGLView] window] addSubview: Edit];
UITextField *nameTextField = [[UITextField alloc] initWithFrame: CGRectMake(100, 228, 220, 28)];
nameTextField.transform = CGAffineTransformMakeRotation(M_PI * (90.0 / 180.0)); // rotate for landscape
// NOTE: UITextField won't be visible by default without setting backGroundColor & borderStyle
nameTextField.backgroundColor = [UIColor clearColor];
nameTextField.borderStyle = UITextBorderStyleRoundedRect;
nameTextField.delegate = self; // set this layer as the UITextFieldDelegate
nameTextField.returnKeyType = UIReturnKeyDone; // add the 'done' key to the keyboard
nameTextField.autocorrectionType = UITextAutocorrectionTypeNo; // switch of auto correction
nameTextField.autocapitalizationType = UITextAutocapitalizationTypeWords;
// add the textField to the main game openGLVview
[[[Director sharedDirector] openGLView] addSubview: nameTextField];