-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUITextField+ValidTextFieldValue.h
56 lines (36 loc) · 1.18 KB
/
UITextField+ValidTextFieldValue.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// UITextField+Valid.h
// JAEnrollmentDemo
//
// Created by jaly on 15/12/10.
// Copyright © 2015年 org.jaly. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger,TextFieldType){
PhoneNumber,
Email,
Letter
};
@interface UITextField (ValidTextFieldValue)<UITextFieldDelegate>
@property (assign,nonatomic) TextFieldType textFieldType;
@property (assign,nonatomic) NSInteger textMinLength;
@property (assign,nonatomic) NSInteger textMaxLength;
@property (strong,nonatomic) NSString *typeError;
@property (strong,nonatomic) NSString *lengthError;
@property (strong,nonatomic) NSString *nilError;
@property (weak,nonatomic) id<UITextFieldDelegate> newDelegate;
/**
* 初始化验证
*/
-(void)initializeValid;
-(void)setTextFieldType:(TextFieldType)textFieldType typeError:(NSString *)typeError;
-(void)setTextMinLength:(NSInteger)textMinLength textMaxLength:(NSInteger)textMaxLength lengthError:(NSString *)lengthError;
-(void)setNilError:(NSString *)nilError;
-(NSString *)validTextField;
@end
@interface NSString (ValidRegex)
-(BOOL)isValidateEmail;
-(BOOL) isValidateMobile;
-(BOOL) isValidateLetter;
-(BOOL)isValidWithRegex:(NSString *)regex;
@end