【发布时间】:2017-02-04 17:26:11
【问题描述】:
- (IBAction)btnA:(id)sender {
if(self.height.constant == 300) {
self.height.constant = 50;
} else {
self.height.constant = 300;
}
[self.subView1 setNeedsUpdateConstraints];
[UIView animateWithDuration:1.0 animations:^{
[self.subView1 layoutIfNeeded];
}];
}
我正在使用此代码,但在 iOS10 上它没有设置动画,它只是跳跃增加和减少 mySubview1 的高度。为什么?
相同的代码在iOS9 中运行良好
【问题讨论】:
-
您可以尝试删除此行并查看它是否有效。 [self.subView1 setNeedsUpdateConstraints];
标签: ios objective-c uiview autolayout ios-autolayout