如何在iPhone的uitextfield中验证电子邮件字段 [英] How to validate email field in uitextfield in iphone

查看:54
本文介绍了如何在iPhone的uitextfield中验证电子邮件字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查在文本字段中输入的字段是否是电子邮件.如果是电子邮件字段,则继续,否则显示一些警报或错误. 我不知道如何验证该领域. 请帮帮我

i would like to check that whether the field entered in the text field is email or not.If its email field then proceed else show some alert or error. I don't know how to validate that field. Please help me out

推荐答案

首先将RegexKit添加到您的项目中. 将RegexKitLite.h导入要检查格式的类

First add RegexKit to your project. Import RegexKitLite.h to the class where you want to check the format

NSString *emailMatchstring=@"\\b([a-zA-Z0-9%_.+\\-]+)@([a-zA-Z0-9.\\-]+?\\.[a-zA-Z]{2,6})\\b";

将此字符串与UITextField的文本进行比较.

compare this string to UITextField's text.

这篇关于如何在iPhone的uitextfield中验证电子邮件字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆