views:

1059

answers:

3

I have two text fields email and password. The following code works fine when the fields are presented on a regular view but when they are on a popover, the resignFirstResponder does not work (becomeFirstResponder works). textFieldsShouldReturn was called for both fields. Any idea if I am missing something? Thanks!

- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {

 if (theTextField == email) {
     [password becomeFirstResponder];
     return NO;
 }

 [theTextField resignFirstResponder];
 return NO;

}

+1  A: 

Are you setting the delegate correctly?

casey
+1  A: 

I'm not too sure about this, but, as I understand the responder hierarchy, resign would work only if you have some other responder to answer.

In a regular view, the view itself is willing. In a popup, maybe you need to do something to your popup class (like reimplement some Responder methods) in order for this to work.

jv42
+1  A: 

Hi mosdev,

I was also having this problem. But I solved this by making a another control, which is not in the popover as firstResponder and later a resigned it from there. But I don't what is the problem with popover.

ypk