增加ifClearAllInBeginEditing

This commit is contained in:
BearXR
2020-01-20 16:34:41 +08:00
parent 327c14148a
commit 4ceb03079e
3 changed files with 12 additions and 0 deletions

View File

@@ -416,6 +416,7 @@
}
};
_boxInputView.ifClearAllInBeginEditing = YES;
[_boxInputView reloadInputString:@"5678"];
return _boxInputView;

View File

@@ -76,6 +76,13 @@ typedef void(^TextEditStatusChangeblock)(CRTextEditStatus editStatus);
*/
@property (strong, nonatomic) NSString * _Nullable placeholderText;
/**
弹出键盘时,是否清空所有输入
只有在输入的字数等于codeLength时生效
default: NO
*/
@property (assign, nonatomic) BOOL ifClearAllInBeginEditing;
@property (copy, nonatomic) TextDidChangeblock _Nullable textDidChangeblock;
@property (copy, nonatomic) TextEditStatusChangeblock _Nullable textEditStatusChangeblock;
@property (strong, nonatomic) CRBoxFlowLayout * _Nullable boxFlowLayout;

View File

@@ -159,6 +159,10 @@ typedef NS_ENUM(NSInteger, CRBoxTextChangeType) {
{
_ifNeedBeginEdit = YES;
if (self.ifClearAllInBeginEditing && self.textValue.length == self.codeLength) {
[self clearAll];
}
if (self.textEditStatusChangeblock) {
self.textEditStatusChangeblock(CRTextEditStatus_BeginEdit);
}