2019-01-03 18:03:44 +08:00
|
|
|
|
//
|
|
|
|
|
|
// CRBoxInputView.h
|
|
|
|
|
|
// CRBoxInputView
|
|
|
|
|
|
//
|
|
|
|
|
|
// Created by Chobits on 2019/1/3.
|
|
|
|
|
|
// Copyright © 2019 Chobits. All rights reserved.
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
|
|
#import "CRBoxFlowLayout.h"
|
|
|
|
|
|
#import "CRBoxInputCellProperty.h"
|
2019-01-06 18:59:10 +08:00
|
|
|
|
#import "CRBoxInputCell.h"
|
2019-01-03 18:03:44 +08:00
|
|
|
|
@class CRBoxInputView;
|
|
|
|
|
|
|
2020-01-20 16:20:36 +08:00
|
|
|
|
typedef NS_ENUM(NSInteger, CRTextEditStatus) {
|
|
|
|
|
|
CRTextEditStatus_Idle,
|
|
|
|
|
|
CRTextEditStatus_BeginEdit,
|
|
|
|
|
|
CRTextEditStatus_EndEdit,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2019-06-11 12:18:15 +08:00
|
|
|
|
typedef void(^TextDidChangeblock)(NSString * _Nullable text, BOOL isFinished);
|
2020-01-20 16:20:36 +08:00
|
|
|
|
typedef void(^TextEditStatusChangeblock)(CRTextEditStatus editStatus);
|
2019-01-03 18:03:44 +08:00
|
|
|
|
|
|
|
|
|
|
@interface CRBoxInputView : UIView
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2019-06-11 12:18:15 +08:00
|
|
|
|
是否需要光标
|
2019-01-09 11:34:31 +08:00
|
|
|
|
ifNeedCursor
|
2019-06-11 12:18:15 +08:00
|
|
|
|
default: YES
|
2019-01-03 18:03:44 +08:00
|
|
|
|
*/
|
|
|
|
|
|
@property (assign, nonatomic) BOOL ifNeedCursor;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2019-06-11 12:18:15 +08:00
|
|
|
|
验证码长度
|
2019-01-09 11:34:31 +08:00
|
|
|
|
codeLength
|
2019-01-03 18:03:44 +08:00
|
|
|
|
default: 4
|
|
|
|
|
|
*/
|
|
|
|
|
|
@property (nonatomic, assign) NSInteger codeLength;
|
|
|
|
|
|
|
2019-01-03 19:44:13 +08:00
|
|
|
|
/**
|
2019-06-11 12:18:15 +08:00
|
|
|
|
是否开启密文模式
|
2019-07-19 00:29:24 +08:00
|
|
|
|
描述:你可以在任何时候修改该属性,并且已经存在的文字会自动刷新。
|
2019-01-09 11:34:31 +08:00
|
|
|
|
ifNeedSecurity
|
2019-07-19 00:29:24 +08:00
|
|
|
|
desc: You can change this property anytime. And the existing texts can be refreshed automatically.
|
2019-01-03 19:44:13 +08:00
|
|
|
|
default: NO
|
|
|
|
|
|
*/
|
|
|
|
|
|
@property (assign, nonatomic) BOOL ifNeedSecurity;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2019-06-11 12:18:15 +08:00
|
|
|
|
显示密文的延时时间
|
|
|
|
|
|
securityDelay
|
|
|
|
|
|
desc: show security delay time
|
2019-01-03 19:44:13 +08:00
|
|
|
|
default: 0.3
|
|
|
|
|
|
*/
|
|
|
|
|
|
@property (assign, nonatomic) CGFloat securityDelay;
|
|
|
|
|
|
|
2019-01-07 12:23:58 +08:00
|
|
|
|
/**
|
2019-06-11 12:18:15 +08:00
|
|
|
|
键盘类型
|
2019-01-09 11:34:31 +08:00
|
|
|
|
keyBoardType
|
2019-01-07 12:23:58 +08:00
|
|
|
|
default: UIKeyboardTypeNumberPad
|
|
|
|
|
|
*/
|
2019-01-03 19:44:13 +08:00
|
|
|
|
@property (assign, nonatomic) UIKeyboardType keyBoardType;
|
2019-01-07 12:23:58 +08:00
|
|
|
|
|
2019-01-10 23:51:17 +08:00
|
|
|
|
/**
|
|
|
|
|
|
textContentType
|
2019-06-11 12:18:15 +08:00
|
|
|
|
描述: 你可以设置为 'nil' 或者 'UITextContentTypeOneTimeCode' 来自动获取短信验证码
|
2019-01-10 23:52:50 +08:00
|
|
|
|
desc: You set this 'nil' or 'UITextContentTypeOneTimeCode' to auto fill verify code.
|
2019-01-10 23:51:17 +08:00
|
|
|
|
default: nil
|
|
|
|
|
|
*/
|
|
|
|
|
|
@property (null_unspecified,nonatomic,copy) UITextContentType textContentType NS_AVAILABLE_IOS(10_0);
|
|
|
|
|
|
|
2019-07-16 14:27:20 +08:00
|
|
|
|
/**
|
2019-07-16 15:07:08 +08:00
|
|
|
|
占位字符填充值
|
2019-07-16 14:27:20 +08:00
|
|
|
|
说明:在对应的输入框没有内容时,会显示该值。
|
2019-07-16 15:07:08 +08:00
|
|
|
|
默认:nil
|
2019-07-16 14:27:20 +08:00
|
|
|
|
*/
|
|
|
|
|
|
@property (strong, nonatomic) NSString * _Nullable placeholderText;
|
|
|
|
|
|
|
2019-06-10 22:39:57 +08:00
|
|
|
|
@property (copy, nonatomic) TextDidChangeblock _Nullable textDidChangeblock;
|
2020-01-20 16:20:36 +08:00
|
|
|
|
@property (copy, nonatomic) TextEditStatusChangeblock _Nullable textEditStatusChangeblock;
|
2019-06-10 22:39:57 +08:00
|
|
|
|
@property (strong, nonatomic) CRBoxFlowLayout * _Nullable boxFlowLayout;
|
|
|
|
|
|
@property (strong, nonatomic) CRBoxInputCellProperty * _Nullable customCellProperty;
|
|
|
|
|
|
@property (strong, nonatomic, readonly) NSString * _Nullable textValue;
|
2019-07-01 11:22:29 +08:00
|
|
|
|
@property (strong, nonatomic) UIView * _Nullable inputAccessoryView;
|
2019-01-03 18:03:44 +08:00
|
|
|
|
|
2019-06-11 12:18:15 +08:00
|
|
|
|
/**
|
|
|
|
|
|
装载数据和准备界面
|
|
|
|
|
|
desc: Load and prepareView
|
|
|
|
|
|
beginEdit: 自动开启编辑模式
|
|
|
|
|
|
default: YES
|
|
|
|
|
|
*/
|
2019-01-04 16:05:34 +08:00
|
|
|
|
- (void)loadAndPrepareView;
|
2019-01-18 11:49:06 +08:00
|
|
|
|
- (void)loadAndPrepareViewWithBeginEdit:(BOOL)beginEdit;
|
|
|
|
|
|
|
2020-01-20 12:31:41 +08:00
|
|
|
|
// 重载输入的数据
|
|
|
|
|
|
- (void)reloadInputString:(NSString *_Nullable)value;
|
|
|
|
|
|
|
2019-06-11 12:18:15 +08:00
|
|
|
|
/**
|
|
|
|
|
|
清空输入
|
|
|
|
|
|
desc: Clear all
|
|
|
|
|
|
beginEdit: 自动开启编辑模式
|
|
|
|
|
|
default: YES
|
|
|
|
|
|
*/
|
2019-01-04 16:05:34 +08:00
|
|
|
|
- (void)clearAll;
|
2019-01-18 12:16:40 +08:00
|
|
|
|
- (void)clearAllWithBeginEdit:(BOOL)beginEdit;
|
|
|
|
|
|
|
2019-06-10 22:39:57 +08:00
|
|
|
|
- (UICollectionView *_Nullable)mainCollectionView;
|
2019-01-04 16:05:34 +08:00
|
|
|
|
|
2019-06-11 12:18:15 +08:00
|
|
|
|
// 快速设置
|
2019-01-04 16:05:34 +08:00
|
|
|
|
// Qiuck set
|
2019-06-10 22:39:57 +08:00
|
|
|
|
- (void)quickSetSecuritySymbol:(NSString *_Nullable)securitySymbol;
|
2019-01-03 18:03:44 +08:00
|
|
|
|
|
2019-06-11 12:18:15 +08:00
|
|
|
|
// 你可以在继承的子类中调用父类方法
|
2019-01-09 11:34:31 +08:00
|
|
|
|
// You can inherit and call super
|
2019-01-06 19:40:28 +08:00
|
|
|
|
- (void)initDefaultValue;
|
|
|
|
|
|
|
2019-06-11 12:18:15 +08:00
|
|
|
|
// 你可以在继承的子类中重写父类方法
|
2019-01-09 11:34:31 +08:00
|
|
|
|
// You can inherit and rewrite
|
2019-06-11 12:18:15 +08:00
|
|
|
|
- (UICollectionViewCell *_Nullable)customCollectionView:(UICollectionView *_Nullable)collectionView cellForItemAtIndexPath:(NSIndexPath *_Nullable)indexPath;
|
2019-01-06 18:59:10 +08:00
|
|
|
|
|
2019-01-03 18:03:44 +08:00
|
|
|
|
@end
|