ios - How to remove keyboard. Normal method not working. objective-c -


i have code.

- (bool)textfieldshouldreturn:(uitextfield *)textfield {     //if user presses next go next textfield     if (textfield == self.emailtextfield) {         [textfield resignfirstresponder];         [self.passwordtextfield becomefirstresponder];     }     else if (textfield == self.passwordtextfield) {         [self.passwordtextfield resignfirstresponder];     }      return yes; } 

this line below runs make textfield inactive , leaves keyboard there. if tap on keys on keyboard nothing.

[self.passwordtextfield resignfirstresponder]; 

this not duplicate question because normal method not working reason.

in case of multiple uitextfields,don't call resignfirstresponder;.you need call endediting:!

call endediting: on view above text fields in view hierarchy. locate first responder , ask resign. use endediting:yes force or endediting:no let text field's delegate decide if should end editing (useful if validating input).

and 1 more thing must aware. have set delegate uitextfields?

set delegate uitextfields.