动画
UIView.animate(withDuration: 0.3) {
let newWidth = (self.progressBgView.width - 2) * progressValue
self.progressView.snp.updateConstraints { make in
make.width.equalTo(newWidth)
}
self.layoutIfNeeded()
}
corner
# 重写 layoutSubviews 方法,注意,这是继承自UIView的类里可用
open override func layoutSubviews() {
super.layoutSubviews()
progressBgView.layer.cornerRadius = progressBgView.height / 2
progressView.layer.cornerRadius = progressView.height / 2
}