how to force user to stay in a specific UITextfield
inside my app i have an UITextfield to let the user to enter Email Address. I implement the delegate method -(void)textFieldDidEndEditing:(UITextField *)textField
to check if the user have had entered a valid Email Address. The Problem is how to let the cursor stuck inside the Email Address textfield while the verification method returns false and out wh开发者_Python百科en the user enter a valid Email.
I am guessing you have the email address checked inside textFieldDidEndEditing
. Use this logic in that method.
if (validEmail)
{
// Not a problem and resignFirstResponder
}
else
{
// Show an UIAlertView describing the problem //
[textField becomeFirstResponder];
}
精彩评论