我在扩展和收缩 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];
}];
}