//
//  NumbersInputBox.swift

//
//  Created by Leon on 2025/7/23.
//

class NumbersInputBox: CLTextField {
    override init(frame: CGRect) {
        super.init(frame: frame)
        setup()
    }

    required init?(coder: NSCoder) {
        super.init(coder: coder)
        setup()
    }

    private func setup() {
        font = .t.tnmm
        textColor = .c.ctpn
        
        
        // 设置固定尺寸
//        frame = CGRect(x: 0, y: 0, width: 80, height: 48)
        snp.makeConstraints { make in
            make.size.equalTo(CGSize(width: 80, height: 48))
        }

        // 设置内容居中
        textAlignment = .center

        // 设置数字键盘
        keyboardType = .numberPad

        // 设置背景和边框
        backgroundColor = .c.csen
        layer.cornerRadius = 8
//        layer.borderWidth = 1
//        layer.borderColor = UIColor.gray.cgColor
//        layer.shadowRadius = 2
//        layer.shadowOpacity = 0.2
//        layer.shadowOffset = CGSize(width: 0, height: 1)

        // 设置内边距
        let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 5, height: frame.height))
        leftView = paddingView
        leftViewMode = .always
        rightView = paddingView
        rightViewMode = .always
    }
}
