开发者

How to validate email field in uitextfield in iphone

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 m开发者_如何学编程e out


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

compare this string to UITextField's text.


I think the regular expression can help you.

NSRegularExpression Class Reference

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜