Masonry实现动画更新约束
2019-07-15 本文已影响0人
路漫漫其修远兮Wzt
// 1.告诉self.view约束需要更新
[self.view setNeedsUpdateConstraints];
// 2.调用此方法告诉self.view检测是否需要更新约束,若需要则更新,下面添加动画效果才起作用
[self.view updateConstraintsIfNeeded];
//3.动画
[UIView animateWithDuration:0.3 animations:^{
[self.view layoutIfNeeded];
}];