对updateConstarints使用UIView的animation动画需要注意的点

34 阅读1分钟

需要在animation的block中layout一下,否则update会立即生效,没有动画效果 大概代码如下

UIView.animate(withDuration: 0.25) {

                someView.mas_updateConstraints { make in

                        make?.width.equalTo()(170)

                        make?.height.equalTo()(125)

                    }

                    self.layoutIfNeeded()

                }