【发布时间】:2014-12-11 02:43:26
【问题描述】:
我正在尝试使用以下代码在动画中增加自定义键盘的高度。 但我无法弄清楚为什么会立即发生变化,忽略动画。
//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];
}];
【问题讨论】:
标签: ios ios8-extension ios-autolayout ios-keyboard-extension