0

I am trying to programmatically set the focus on a new UITextField that I created using becomeFirstResponder. Is there any other way?

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

}
GoZoner
  • 59,252
  • 19
  • 87
  • 137

0 Answers0