// 1.告诉self.view约束需要更新
[self.view setNeedsUpdateConstraints];
// 2.调用此方法告诉self.view检测是否需要更新约束,若需要则更新,下面添加动画效果才起作用
[self.view updateConstraintsIfNeeded];
//3.动画
[UIView animateWithDuration:0.3 animations:^{
[self.view layoutIfNeeded];
}];
// 1.告诉self.view约束需要更新
[self.view setNeedsUpdateConstraints];
// 2.调用此方法告诉self.view检测是否需要更新约束,若需要则更新,下面添加动画效果才起作用
[self.view updateConstraintsIfNeeded];
//3.动画
[UIView animateWithDuration:0.3 animations:^{
[self.view layoutIfNeeded];
}];
本文标题:Masonry实现动画更新约束
本文链接:https://www.haomeiwen.com/subject/fdkokctx.html
网友评论