根据文档在updateConstraints里更换了约束
- (void)updateConstraints {
if (self.isEditing) {
[self.selectedBtn mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(20);
}];
} else {
[self.selectedBtn mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(0);
}];
}
[super updateConstraints];
}
在外层调用了[view setNeedsUpdateConstraints];
结果直接就显示出来了,没有动画效果。
尝试了用animateWithDurtaion
[UIView animateWithDuration:5
animations:^{
[view setNeedsUpdateConstraints];
}];
也是不行。
应该怎么做呢?