Skip to content

Commit 46b8eb1

Browse files
committed
readMe初步调整
1 parent 6fa073f commit 46b8eb1

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

Example/CRBoxInputView/CRDetailViewController.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@ - (CRBoxInputView *)generateBoxInputView_normal
319319
CRBoxInputView *_boxInputView = [[CRBoxInputView alloc] initWithCodeLength:4];
320320
_boxInputView.mainCollectionView.contentInset = UIEdgeInsetsMake(0, 20, 0, 20);
321321
[_boxInputView loadAndPrepareViewWithBeginEdit:YES];
322+
_boxInputView.inputType = CRInputType_Number;
323+
324+
_boxInputView.inputType = CRInputType_Regex;
325+
_boxInputView.customInputRegex = @"[^0-9]";
322326

323327
if (@available(iOS 12.0, *)) {
324328
_boxInputView.textContentType = UITextContentTypeOneTimeCode;

PodCode/Classes/CRBoxInputView.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ typedef NS_ENUM(NSInteger, CRInputType) {
2323
CRInputType_Number,
2424
/// 普通(不作任何处理)
2525
CRInputType_Normal,
26-
/// 自定义正则
26+
/// 自定义正则(此时需要设置customInputRegex)
2727
CRInputType_Regex,
2828
};
2929

@@ -44,7 +44,7 @@ typedef void(^TextEditStatusChangeblock)(CRTextEditStatus editStatus);
4444
codeLength
4545
default: 4
4646
*/
47-
@property (nonatomic, assign, readonly) NSInteger codeLength; //If you want to set codeLength, please use `- (instancetype)initWithCodeLength:(NSInteger)codeLength, or - (void)resetCodeLength:(NSInteger)codeLength beginEdit:(BOOL)beginEdit` in CRBoxInputView.
47+
@property (nonatomic, assign, readonly) NSInteger codeLength; //If you want to set codeLength, please use `- (instancetype)initWithCodeLength:(NSInteger)codeLength, or - (void)resetCodeLength:(NSInteger)codeLength beginEdit:(BOOL)beginEdit` in CRBoxInputView.
4848

4949
/**
5050
是否开启密文模式

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ boxInputView.keyBoardType = UIKeyboardTypeNumberPad;// 不设置时,默认UIKe
6161
[boxInputView loadAndPrepareViewWithBeginEdit:YES]; // BeginEdit:是否自动启用编辑模式
6262
[self.view addSubview:boxInputView];
6363

64+
// 输入类型(纯数字)
65+
_boxInputView.inputType = CRInputType_Number;
66+
67+
// 输入类型(正则表达式)
68+
//_boxInputView.inputType = CRInputType_Regex;
69+
//_boxInputView.customInputRegex = @"[^0-9]";
70+
6471
// 获取值
6572
// 方法1, 当输入文字变化时触发回调block
6673
boxInputView.textDidChangeblock = ^(NSString *text, BOOL isFinished) {

README_en.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ boxInputView.keyBoardType = UIKeyboardTypeNumberPad;
5757
[boxInputView loadAndPrepareViewWithBeginEdit:YES]; // BeginEdit: If need begin edit.
5858
[self.view addSubview:boxInputView];
5959

60+
// inputType(number)
61+
_boxInputView.inputType = CRInputType_Number;
62+
63+
// inputType(regex)
64+
//_boxInputView.inputType = CRInputType_Regex;
65+
//_boxInputView.customInputRegex = @"[^0-9]";
66+
6067
// Get value
6168
// func1, call back block when input text did change
6269
boxInputView.textDidChangeblock = ^(NSString *text, BOOL isFinished) {

0 commit comments

Comments
 (0)