Commit 8ec0b5d9 authored by Steven杜宇's avatar Steven杜宇

// mod 验证码输入

parent 3687f491
......@@ -32,7 +32,7 @@ class YHSmsCodeInputView: UIView {
// 此输入框并不显示,只是接收输入
lazy var textField: UITextField = {
let textField = UITextField()
textField.backgroundColor = .red
textField.backgroundColor = .clear
textField.tintColor = .clear
textField.textColor = .clear
textField.delegate = self
......@@ -76,13 +76,20 @@ class YHSmsCodeInputView: UIView {
let isEven = (config.count % 2 == 0)
for index in 1...count {
let inputView = YHSmsCodeView(frame: CGRectZero)
let inputView = YHSmsCodeView(frame: CGRectZero)
inputView.backgroundColor = config.bgColor
inputView.label.font = config.font
inputView.label.textColor = config.textColor
inputView.cursor.backgroundColor = config.cursorColor
if (index == 1) {
inputView.showCursor = true
}
inputView.tag = codeViewBaseTag + index
self.addSubview(inputView)
// 此处布局为轴对称布局
// 小组件右边距离父视图中轴线间距
var rightMargin = 0.0;
if (isEven) { // 输入框个数为偶数
......
......@@ -26,7 +26,14 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
}()
lazy var smsInputView: YHSmsCodeInputView = {
let codeView = YHSmsCodeInputView(config: YHSmsCodeViewConfig())
var config = YHSmsCodeViewConfig()
let codeView = YHSmsCodeInputView(config:config)
codeView.complete = {
(text) in
print(text)
}
return codeView
}()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment