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