@@ -30,32 +30,125 @@ - (void)viewDidLoad {
3030
3131- (void )jhSetupViews
3232{
33- UILabel *label = [[UILabel alloc ] init ];
34- label.frame = CGRectMake (0 , 150 , kScreenWidth , 30 );
35- label.textAlignment = 1 ;
36- [self .view addSubview: label];
37-
38- JHVCConfig *config = [[JHVCConfig alloc ] init ];
39- config.inputBoxNumber = 6 ;
40- config.inputBoxSpacing = 5 ;
41- config.inputBoxWidth = 33 ;
42- config.inputBoxHeight = 28 ;
43- config.tintColor = [UIColor blackColor ];
44- config.secureTextEntry = NO ;
45- config.inputBoxColor = [UIColor brownColor ];
46- config.font = [UIFont boldSystemFontOfSize: 16 ];
47- config.textColor = [UIColor brownColor ];
48- config.inputType = JHVCConfigInputType_Number_Alphabet;
33+ // example 1
34+ {
35+ UILabel *label = [[UILabel alloc ] init ];
36+ label.frame = CGRectMake (0 , 120 , kScreenWidth , 30 );
37+ label.textAlignment = 1 ;
38+ label.text = @" InputType: Number & Alphabet" ;
39+ [self .view addSubview: label];
40+
41+ JHVCConfig *config = [[JHVCConfig alloc ] init ];
42+ config.inputBoxNumber = 6 ;
43+ config.inputBoxSpacing = 5 ;
44+ config.inputBoxWidth = 33 ;
45+ config.inputBoxHeight = 28 ;
46+ config.tintColor = [UIColor blackColor ];
47+ config.secureTextEntry = NO ;
48+ config.inputBoxColor = [UIColor brownColor ];
49+ config.font = [UIFont boldSystemFontOfSize: 16 ];
50+ config.textColor = [UIColor blueColor ];
51+ config.inputType = JHVCConfigInputType_Number_Alphabet;
52+
53+ config.inputBoxBorderWidth = 1 ;
54+ config.inputBoxCornerRadius = 5 ;
55+
56+
57+ [self .view addSubview: ({
58+
59+ UILabel *label = [[UILabel alloc ] init ];
60+ label.frame = CGRectMake (0 , 180 , kScreenWidth , 30 );
61+ label.textAlignment = 1 ;
62+ [self .view addSubview: label];
63+
64+ JHVerificationCodeView *codeView =
65+ [[JHVerificationCodeView alloc ] initWithFrame: CGRectMake (10 , 150 , kScreenWidth -20 , 30 )
66+ config: config];
67+ codeView.finishBlock = ^(NSString *code) {
68+ label.text = code;
69+ };
70+ codeView;
71+ })];
72+ }
73+
74+ // example 2
75+ {
76+ UILabel *label = [[UILabel alloc ] init ];
77+ label.frame = CGRectMake (0 , 210 , kScreenWidth , 30 );
78+ label.textAlignment = 1 ;
79+ label.text = @" InputType: Number" ;
80+ [self .view addSubview: label];
81+
82+ JHVCConfig *config = [[JHVCConfig alloc ] init ];
83+ config.inputBoxNumber = 6 ;
84+ config.inputBoxSpacing = 5 ;
85+ config.inputBoxWidth = 33 ;
86+ config.inputBoxHeight = 28 ;
87+ config.tintColor = [UIColor blackColor ];
88+ config.secureTextEntry = NO ;
89+ config.inputBoxColor = [UIColor brownColor ];
90+ config.font = [UIFont boldSystemFontOfSize: 16 ];
91+ config.textColor = [UIColor cyanColor ];
92+ config.inputType = JHVCConfigInputType_Number;
93+
94+ config.inputBoxBorderWidth = 1 ;
95+ config.inputBoxHighlightedColor = [UIColor purpleColor ];
96+
97+ [self .view addSubview: ({
98+
99+ UILabel *label = [[UILabel alloc ] init ];
100+ label.frame = CGRectMake (0 , 270 , kScreenWidth , 30 );
101+ label.textAlignment = 1 ;
102+ [self .view addSubview: label];
103+
104+ JHVerificationCodeView *codeView =
105+ [[JHVerificationCodeView alloc ] initWithFrame: CGRectMake (10 , 240 , kScreenWidth -20 , 30 )
106+ config: config];
107+ codeView.finishBlock = ^(NSString *code) {
108+ label.text = code;
109+ };
110+ codeView;
111+ })];
112+ }
49113
50- [self .view addSubview: ({
51- JHVerificationCodeView *codeView =
52- [[JHVerificationCodeView alloc ] initWithFrame: CGRectMake (10 , 100 , kScreenWidth -20 , 30 )
53- config: config];
54- codeView.finishBlock = ^(NSString *code) {
55- label.text = code;
56- };
57- codeView;
58- })];
114+ // example 3
115+ {
116+ UILabel *label = [[UILabel alloc ] init ];
117+ label.frame = CGRectMake (0 , 300 , kScreenWidth , 30 );
118+ label.textAlignment = 1 ;
119+ label.text = @" InputType: Alphabet" ;
120+ [self .view addSubview: label];
121+
122+ JHVCConfig *config = [[JHVCConfig alloc ] init ];
123+ config.inputBoxNumber = 6 ;
124+ config.inputBoxSpacing = -1 ;
125+ config.inputBoxWidth = 33 ;
126+ config.inputBoxHeight = 28 ;
127+ config.tintColor = [UIColor blackColor ];
128+ config.secureTextEntry = NO ;
129+ config.inputBoxColor = [UIColor brownColor ];
130+ config.font = [UIFont boldSystemFontOfSize: 16 ];
131+ config.textColor = [UIColor grayColor ];
132+ config.inputType = JHVCConfigInputType_Alphabet;
133+
134+ config.inputBoxBorderWidth = 1 ;
135+
136+ [self .view addSubview: ({
137+
138+ UILabel *label = [[UILabel alloc ] init ];
139+ label.frame = CGRectMake (0 , 360 , kScreenWidth , 30 );
140+ label.textAlignment = 1 ;
141+ [self .view addSubview: label];
142+
143+ JHVerificationCodeView *codeView =
144+ [[JHVerificationCodeView alloc ] initWithFrame: CGRectMake (10 , 330 , kScreenWidth -20 , 30 )
145+ config: config];
146+ codeView.finishBlock = ^(NSString *code) {
147+ label.text = code;
148+ };
149+ codeView;
150+ })];
151+ }
59152
60153}
61154
0 commit comments