I'm trying to increase my custom keyboard' height in an animation with the following code. But I can't figure out why the change occures instantly, ignoring the animation.
//In viewDidAppear
[self.view needsUpdateConstraints];
[UIView animateWithDuration:2 animations:^{
CGFloat _expandedHeight = 500;
NSLayoutConstraint *_heightConstraint = [NSLayoutConstraint
constraintWithItem: self.view
attribute: NSLayoutAttributeHeight
relatedBy: NSLayoutRelationEqual
toItem: nil
attribute: NSLayoutAttributeNotAnAttribute
multiplier: 0.0
constant: _expandedHeight];
[self.view addConstraint: _heightConstraint];
[self.view layoutIfNeeded];
}];