/**
处理键盘弹出、隐藏、更新frame动画
@param duration 动画时间
@param keyboardOriginY 键盘纵向起点
*/
- (void)keybaordAnimationWithDuration:(CGFloat)duration keyboardOriginY:(CGFloat)keyboardOriginY{
//作为视图的键盘,弹出动画也是UIViewAnimationOptionCurveEaseIn的方式
[UIView animateWithDuration:duration delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
//text field
CGPoint textFieldOrigin = _viewInput.frame.origin;
CGSize textFieldSize = _viewInput.frame.size;
_bottomViewInput.constant = SCREEN_HEIGHT - keyboardOriginY;
[self.view layoutIfNeeded]; //必须加上这句话才能曾加 constraintlayout 动效
} completion:^(BOOL finished) {
// [self refreshLayout];
}];
}