Skip to content

Commit c4c0546

Browse files
committed
customInputHolder
1 parent e3b60dd commit c4c0546

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

JHVerificationCodeView/JHVerificationCodeView/JHVerificationCodeView.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ typedef NS_ENUM(NSUInteger, JHVCConfigInputType) {
7676
@property (nonatomic, strong) UIColor *underLineColor;
7777
///下划线高亮颜色
7878
@property (nonatomic, strong) UIColor *underLineHighlightedColor;
79+
///自定义的输入占位字符,secureTextEntry = NO,有效
80+
@property (nonatomic, copy) NSString *customInputHolder;
7981
@end
8082

8183
@interface JHVerificationCodeView : UIView

JHVerificationCodeView/JHVerificationCodeView/JHVerificationCodeView.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,14 @@ - (void)xx_textChange:(NSNotification *)noti
284284
unichar c = [text characterAtIndex:i];
285285
UITextField *textField = self.subviews[i];
286286
textField.text = [NSString stringWithFormat:@"%c",c];
287+
if (!textField.secureTextEntry && _config.customInputHolder.length > 0) {
288+
textField.text = _config.customInputHolder;
289+
}
287290

288291
if (_config.inputBoxHighlightedColor) {
289292
textField.layer.borderColor = _config.inputBoxHighlightedColor.CGColor;
290293
}
291-
294+
292295
if (_config.showUnderLine && _config.underLineHighlightedColor) {
293296
UIView *underLine = [textField viewWithTag:100];
294297
underLine.backgroundColor = _config.underLineHighlightedColor;

JHVerificationCodeView/ViewController.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ - (void)jhSetupViews
6161

6262
config.inputBoxBorderWidth = 1;
6363
config.inputBoxCornerRadius = 5;
64-
64+
65+
config.customInputHolder = @"🔒";
6566

6667
[self.view addSubview:({
6768

@@ -103,6 +104,8 @@ - (void)jhSetupViews
103104

104105
config.inputBoxBorderWidth = 1;
105106
config.inputBoxHighlightedColor = [UIColor purpleColor];
107+
108+
config.customInputHolder = @"🈲";
106109

107110
[self.view addSubview:({
108111

@@ -136,13 +139,15 @@ - (void)jhSetupViews
136139
config.inputBoxWidth = 33;
137140
config.inputBoxHeight = 28;
138141
config.tintColor = [UIColor redColor];
139-
config.secureTextEntry = YES;
142+
config.secureTextEntry = NO;
140143
config.inputBoxColor = [UIColor brownColor];
141144
config.font = [UIFont boldSystemFontOfSize:16];
142145
config.textColor = [UIColor grayColor];
143146
config.inputType = JHVCConfigInputType_Alphabet;
144147

145148
config.inputBoxBorderWidth = 1;
149+
150+
config.customInputHolder = @"❄️";
146151

147152
[self.view addSubview:({
148153

0 commit comments

Comments
 (0)