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

2023-05-16

动画

        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
        
    }

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Swift UIView SnapKit updateConstraints 如何做动画(animate animation)和 cornerRadius 的相关文章

随机推荐