cdts/xdts-ios 3/TreeHole/Code/Utility/WLUnitField/WLUnitField.h

139 lines
4.4 KiB
C
Raw Normal View History

2023-07-27 09:20:00 +08:00
//
// WLUnitField.h
// WLUnitField
//
// Created by wayne on 16/11/22.
// Copyright © 2016年 wayne. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
#ifdef NSFoundationVersionNumber_iOS_9_x_Max
UIKIT_EXTERN NSNotificationName const WLUnitFieldDidBecomeFirstResponderNotification;
UIKIT_EXTERN NSNotificationName const WLUnitFieldDidResignFirstResponderNotification;
#else
UIKIT_EXTERN NSString *const WLUnitFieldDidBecomeFirstResponderNotification;
UIKIT_EXTERN NSString *const WLUnitFieldDidResignFirstResponderNotification;
#endif
/**
UnitField
- WLUnitFieldStyleBorder: , UnitField
- WLUnitFieldStyleUnderline: 线
*/
typedef NS_ENUM(NSUInteger, WLUnitFieldStyle) {
WLUnitFieldStyleBorder,
WLUnitFieldStyleUnderline
};
@protocol WLUnitFieldDelegate;
IB_DESIGNABLE
@interface WLUnitField : UIControl <UITextInput>
@property (nullable, nonatomic, weak) id<WLUnitFieldDelegate> delegate;
/**
使
*/
@property (nullable, nonatomic, copy) IBInspectable NSString *text;
@property(null_unspecified,nonatomic,copy) IBInspectable UITextContentType textContentType NS_AVAILABLE_IOS(10_0); // default is nil
#if TARGET_INTERFACE_BUILDER
/**
WLUnitField 1 ~ 8
*/
@property (nonatomic, assign) IBInspectable NSUInteger inputUnitCount;
/**
UnitField , WLUnitFieldStyleBorder.
*/
@property (nonatomic, assign) IBInspectable NSUInteger style;
#else
@property (nonatomic, assign, readonly) NSUInteger inputUnitCount;
@property (nonatomic, assign, readonly) WLUnitFieldStyle style;
#endif
/**
Unit 0
1 2 3 4 unitSpace is 0.
1 2 3 4 unitSpace is 6
*/
@property (nonatomic, assign) IBInspectable NSUInteger unitSpace;
/**
1 2 3 4 unitSpace is 6, borderRadius is 4.
1 2 3 4 unitSpace is 0, borderRadius is 4.
*/
@property (nonatomic, assign) IBInspectable CGFloat borderRadius;
/**
1
*/
@property (nonatomic, assign) IBInspectable CGFloat borderWidth;
/**
*/
@property (nonatomic, strong) IBInspectable UIFont *textFont;
/**
*/
@property (null_resettable, nonatomic, strong) IBInspectable UIColor *textColor;
@property (null_resettable, nonatomic, strong) IBInspectable UIColor *tintColor;
/**
unit unit nil
`unitSpace` 2 使`cursorColor`
*/
@property (nullable, nonatomic, strong) IBInspectable UIColor *trackTintColor;
/**
*/
@property (nullable, nonatomic, strong) IBInspectable UIColor *cursorColor;
/**
NO
*/
@property (nonatomic, assign) IBInspectable BOOL autoResignFirstResponderWhenInputFinished;
/**
unitfield , 44x44
*/
@property (nonatomic, assign) IBInspectable CGSize unitSize;
- (instancetype)initWithInputUnitCount:(NSUInteger)count;
- (instancetype)initWithStyle:(WLUnitFieldStyle)style inputUnitCount:(NSUInteger)count;
@end
@protocol WLUnitFieldDelegate <UITextFieldDelegate>
@optional
- (BOOL)unitField:(WLUnitField *)uniField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;
@end
NS_ASSUME_NONNULL_END