//
//   DDBaseTextField.m
//   DDBasicControlsKit_Private
//   Created by DDIsFriend on 2023/2/21.
    

#import "DDBaseTextField.h"

@implementation DDBaseTextField

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.textLimitCount = UINTMAX_MAX;
        [self addTarget:self action:@selector(limitTextCount:) forControlEvents:UIControlEventEditingChanged];
    }
    return self;
}

- (void)limitTextCount:(UITextField *)textField{
    if (textField.text.length >= self.textLimitCount) {
        textField.text = [textField.text substringToIndex:self.textLimitCount];
    }
}
@end
