//
//  AuthCodeTextField.m
//  隐私保护
//
//  Created by xd h on 2023/11/7.
//

#import "AuthCodeTextField.h"

@implementation AuthCodeTextField

-(instancetype)init{
    if(self = [super init]){
        //self.keyboardType = UIKeyboardTypeNumberPad;
        self.textAlignment = NSTextAlignmentCenter;
        self.backgroundColor = [UIColor hwColor:@"#E3E8F1" alpha:1.0];
        self.layer.cornerRadius = 4;
        self.layer.masksToBounds = YES;
        self.textColor = [UIColor blackColor];
        self.font = [UIFont boldSystemFontOfSize:16.0];
       // iOS12.0 系统之后，可以自动获取短信中的验证码
        if(@available(iOS 12.0,*)){
           // self.textContentType = UITextContentTypeOneTimeCode;
        }
    }
    return self;
}
// 把这个代理方法传递出去
-(void)deleteBackward{
    if(self.text.length == 0){
        if([self.auth_delegate respondsToSelector:@selector(authCodeTextFieldDeleteBackward:)]){
            [self.auth_delegate authCodeTextFieldDeleteBackward:self];
        }
    }
    [super deleteBackward];
}

@end
