Files
CRBoxInputView/PodCode/Classes/CRBoxInputView.h

129 lines
3.4 KiB
C
Raw Normal View History

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;
2020-01-20 16:34:41 +08:00
/**
codeLength时
default: NO
*/
@property (assign, nonatomic) BOOL ifClearAllInBeginEditing;
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;
- (void)loadAndPrepareViewWithBeginEdit:(BOOL)beginEdit;
// 重载输入的数据
- (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;
- (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