Sou*_*Das 8 animation frame uiview ios
我试图动画UIView的帧变化,其中原点和大小都发生变化.动画看起来并不流畅,并且具有弹性效果.我使用以下代码来做到这一点
[UIView
animateWithDuration:0.5
animations:^{
self.view.frame = newFrame;
}];
Run Code Online (Sandbox Code Playgroud)
看起来大小首先变化非常快,然后原点随动画的指定持续时间而变化,最终导致弹性效果.如何让它看起来光滑?
Mel*_*son 12
您可以尝试更改动画曲线,也可以尝试线性曲线.
dispatch_async(dispatch_get_main_queue(), ^{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
self.view.frame = newFrame;
[UIView commitAnimations];
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14503 次 |
| 最近记录: |