1

can anybody help me in such situation:

I have SigninController class with two textFields (as Outlets) txtLogin and txtPassword:

when I filled txtLogin, I call [txtPassword becomeFirstResponder] to pass input focus to next field (return button works fine in txtLogin), but Return button doesn't work in txtPassword and I can't dismiss keyboard in this case. What did I write wrong ?

Example code:

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    if (textField == txtLogin) {
        [txtLogin resignFirstResponder];      //Works as I think
        [txtPassword becomeFirstResponder];   // txtPassword gets focus
    } else {
        [self signinClick];  //Never enter here
    }
    return YES;
}


- (IBAction)signinClick
{
    NSLog(@"Signin Clicked");
    [activityIndicator startAnimating];
    [txtPassword resignFirstResponder];
    ..........
}
Anomie
  • 92,546
  • 13
  • 126
  • 145
LIAL
  • 1,624
  • 4
  • 24
  • 30

2 Answers2

2

It seems you have forgot to set the delegate of txtPassword correctly.

EmptyStack
  • 51,274
  • 23
  • 147
  • 178
  • Thanks a lot. It was my stupid fault. Sorry - couldn't click UP arrow for your answer (I'm newb here and have no enought repuation to vote) – LIAL Jul 11 '11 at 16:30
0

specify

urtextfieldobject.delegate=self;

then urViewcontroller.h

@interface urViewcontroller

make sure both of them