Skip to content

Commit ba9e8ab

Browse files
committed
增加文本自定义处理
1 parent f2d694a commit ba9e8ab

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

PodCode/Classes/CRBoxInputView.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ typedef NS_ENUM(NSInteger, CRInputType) {
2929

3030
typedef void(^TextDidChangeblock)(NSString * _Nullable text, BOOL isFinished);
3131
typedef void(^TextEditStatusChangeblock)(CRTextEditStatus editStatus);
32+
typedef NSString *(^TextCustomProcessblock)(NSString * _Nullable text);
3233

3334
@interface CRBoxInputView : UIView
3435

@@ -110,6 +111,8 @@ default: @""
110111

111112
@property (copy, nonatomic) TextDidChangeblock _Nullable textDidChangeblock;
112113
@property (copy, nonatomic) TextEditStatusChangeblock _Nullable textEditStatusChangeblock;
114+
/// 文本自定义处理
115+
@property (copy, nonatomic) TextCustomProcessblock _Nullable textCustomProcessblock;
113116
@property (strong, nonatomic) CRBoxFlowLayout * _Nullable boxFlowLayout;
114117
@property (strong, nonatomic) CRBoxInputCellProperty * _Nullable customCellProperty;
115118
@property (strong, nonatomic, readonly) NSString * _Nullable textValue;

PodCode/Classes/CRBoxInputView.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@ - (void)baseTextDidChange:(UITextField *)textField manualInvoke:(BOOL)manualInvo
301301
verStr = [verStr stringByReplacingOccurrencesOfString:@" " withString:@""];
302302
verStr = [self filterInputContent:verStr];
303303

304+
//自定义处理
305+
if (self.textCustomProcessblock) {
306+
verStr = self.textCustomProcessblock(verStr);
307+
}
308+
304309
if (verStr.length >= _codeLength) {
305310
verStr = [verStr substringToIndex:_codeLength];
306311
[self endEdit];

0 commit comments

Comments
 (0)