Masonry动画更新约束

[self.view addSubview:siftView];

// siftView中含有子view, 此时在屏幕外

[siftView mas_makeConstraints:^(MASConstraintMaker *make) {

make.top.mas_equalTo(weakSelf.view.mas_top);

make.left.mas_equalTo(weakSelf.view.mas_left);

make.bottom.mas_equalTo(weakSelf.view.mas_bottom);

make.right.mas_equalTo(weakSelf.view.mas_right);

}];

// 动画开始前强制刷新

[siftView layoutIfNeeded];

// 更新约束

[siftView.siftView mas_updateConstraints:^(MASConstraintMaker *make) {

make.right.mas_equalTo(siftView.mas_right);

}];

// 在UIView的动画中调用强制刷新产生动画效果

[UIView animateWithDuration:0.2 animations:^{

[siftView layoutIfNeeded];

}];

你可能感兴趣的:(Masonry动画更新约束)