我在扩展和收缩 UIEffectView 时遇到问题。它可以很好地扩展,但当它收缩时,它会立即弹到最终高度并滑入到位,在它的尾迹中留下微弱的振动效果。这是一个 gif 来说明这个问题。 http://i.imgur.com/Lh8q7m1.gif
这发生在一个新的空白项目设置中,如下所示:
这是动画代码:
- (IBAction)toggleEffects:(id)sender {
[self.view setNeedsLayout];
if(self._effectsHeight.constant == 50){
self._effectsHeight.constant = 500;
}else{
self._effectsHeight.constant = 50;
}
[UIView animateWithDuration:1.5f
animations:^{
[self.view layoutIfNeeded];
}];
最佳答案
我认为你必须在动画 block 中设置调整大小的代码。试试这个方法:
[UIView animateWithDuration:1.5f
animations:^{
if(self._effectsHeight.constant == 50){
self._effectsHeight.constant = 500;
}else{
self._effectsHeight.constant = 50;
}
}];
关于ios - UIVisualEffectView 模糊约束动画错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27158625/