Issues dismissing keyboard conditionally with on iPhone

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-03-30T16:20:35Z Indexed on 2010/03/30 16:23 UTC
Read the original article Hit count: 301

Filed under:
|
|

I have an app that has a username and password field. I want to validate the input before the the user is allowed to stop editing the field. To do that, I'm using the textFieldShouldEndEditing delegate method. If the input doesn't validate I display a UIAlertView.

This approach works as advertised - the user cannot leave the field if the input doesn't validate.

To have the done button on the keyboard dismiss the keyboard, I call resignFirstResponder on the textfield.

The issue I have is the alert is being called twice. How do I keep the alert from showing twice?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c