美文网首页
Masonry实现动画更新约束

Masonry实现动画更新约束

作者: 路漫漫其修远兮Wzt | 来源:发表于2019-07-15 17:39 被阅读0次
// 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