Commit 0f0d9f8e authored by Steven杜宇's avatar Steven杜宇

// 验证码UI更新

parent 08a31016
......@@ -10,16 +10,16 @@ import UIKit
// 输入框UI显示配置
struct YHSmsCodeViewConfig {
var textColor : UIColor? = UIColor(hex: 0x000000)
var bgColor : UIColor? = UIColor(hex: 0xebeef4)
var cursorColor : UIColor? = UIColor.brandMainColor
var font: UIFont? = .systemFont(ofSize: 20)
var textColor : UIColor? = UIColor(hex: 0xFFFFFF)
var bgColor : UIColor? = UIColor.clear
var cursorColor : UIColor? = UIColor.white
var font: UIFont? = UIFont(name: "DINAlternate-Bold", size: 18)
// 展示输入框个数
var count : Int = 6
var width : Double = 45.0
var height : Double = 50.0
var width : Double = 46.0
var height : Double = 46.0
// 输入框之间间距
var gap:Double = 10
var gap:Double = 12
}
let codeViewBaseTag = 9527
......
......@@ -15,12 +15,12 @@ class YHSmsCodeView: UIView {
if showCursor {
self.cursor.layer .removeAllAnimations()
self.animaitonShow(true)
self.layer.borderWidth = 1
self.layer.borderColor = UIColor.brandMainColor.cgColor
self.bottomLine.backgroundColor = .white
} else {
self.cursor.layer .removeAllAnimations()
self.cursor.isHidden = true
self.layer.borderWidth = 0
self.bottomLine.backgroundColor = UIColor.init(hex: 0xFFFFFF, alpha: 0.6)
}
}
}
......@@ -33,16 +33,22 @@ class YHSmsCodeView: UIView {
let label = UILabel()
label.textColor = .white
label.textAlignment = .center
label.font = UIFont.systemFont(ofSize: 20)
label.font = UIFont(name: "DINAlternate-Bold", size: 18)
return label
}()
var cursor : UIView = {
lazy var cursor : UIView = {
let cursor = UIView()
cursor.backgroundColor = UIColor.brandMainColor
cursor.backgroundColor = UIColor.white
cursor.isHidden = true
return cursor
}()
lazy var bottomLine: UIView = {
let view = UIView()
view.backgroundColor = UIColor.init(hex: 0xFFFFFF, alpha: 0.6)
return view
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
......@@ -57,10 +63,11 @@ class YHSmsCodeView: UIView {
self.isUserInteractionEnabled = false
self.layer.cornerRadius = kCornerRadius3
self.clipsToBounds = true
self.backgroundColor = UIColor(white: 1, alpha: 0.3)
self.backgroundColor = .clear
self.addSubview(label)
self.addSubview(cursor)
self.addSubview(bottomLine)
}
@objc func animaitonShow(_ show: Bool) {
......@@ -81,7 +88,8 @@ class YHSmsCodeView: UIView {
override func layoutSubviews() {
self.label.frame = self.bounds
self.cursor.bounds = CGRectMake(0, 0, 1.5, self.frame.size.height - 20);
self.cursor.bounds = CGRectMake(0, 0, 1, 17);
self.cursor.center = CGPoint(x:CGRectGetMidX(self.bounds) , y: CGRectGetMidY(self.bounds))
self.bottomLine.frame = CGRect(x: 0, y: self.frame.size.height-1, width: self.frame.size.width, height: 1)
}
}
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