我在一个视图中有很多文本字段,而不是用户填写所有详细信息并点击保存按钮,我只想验证在那里输入的电子邮件 ID。当用户转到下一个文本字段时如何在标签中给出错误消息
NSString *emailRegEx = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegEx];
if([emailTest evaluateWithObject:self.emailidTexField.text] == NO)
{
// UILabel besides the text field and when the user goes to next field logic here.
}