使用Masonry布局蟹肘。然后使用mas_update更新約束做了一個動畫。更新約束部分代碼如下(在監(jiān)聽鍵盤彈出的方法里)
[self.myView mas_updateConstraints:^(MASConstraintMaker*make) {
? ? ? ? make.width.height.mas_equalTo(10);//size變小
}];
[UIView animateWithDuration:.3 animations:^{
? ? ? ? [self.view layoutIfNeeded];
}];
修正 bug:
把最后一句[self.view layoutIfNeeded];改為[self.view layoutSubviews];,取消第一響應(yīng)的時候文字就不會跳動了复哆。
[UIView animateWithDuration:.3 animations:^{
? ? ? ? [self.view layoutSubviews];
}];