开发者

how to force user to stay in a specific UITextfield

开发者 https://www.devze.com 2023-04-13 01:22 出处:网络
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 userhave had entered a

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];

      }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号