我正在尝试以编程方式将焦点设置在我使用becomeFirstResponder创建的新UITextField上。还有其他办法吗?
-(void) editPlayerName
{
lblPLayerName.visible = FALSE;
NSString* fontNm = @"Chalkduster";
tfPlayerName = [[UITextField alloc] initWithFrame:CGRectMake(40,20,200,24)];
tfPlayerName.text = [myS playerName];
tfPlayerName.borderStyle = UITextBorderStyleNone;
tfPlayerName.textColor = [UIColor redColor];
tfPlayerName.font = [UIFont fontWithName:fontNm size:20];
tfPlayerName.delegate = self;
UIView* glView = [CCDirector sharedDirector].openGLView;
[glView addSubview:tfPlayerName];
[tfPlayerName becomeFirstResponder];
}