以前用storyboard時(shí)候 把約束拖出來屬性 改變約束時(shí)候 總是實(shí)現(xiàn)不了動(dòng)畫效果 用frame布局時(shí)候用UIView的動(dòng)畫卻沒問題 經(jīng)過查詢資料 發(fā)現(xiàn)需要用UIView的動(dòng)畫去執(zhí)行l(wèi)ayoutIfNeed 以鍵盤舉例? 代碼如下
self.viewBottomLayout.constant = frame.size.height;
? ? //用layoutIfNeeded方法可以實(shí)現(xiàn)動(dòng)畫
? ? [UIView animateWithDuration:keyboardDuration animations:^{
?? ? ? ? ? [self.view layoutIfNeeded];
? ? }];