Swift UIView SnapKit updateConstraints 如何做动画(animate animation)和 cornerRadius

动画

        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
        
    }

猜你喜欢

转载自blog.csdn.net/linzhiji/article/details/130411076