我有这个代码:successview是我的视图,它以alpha 0.00开头但是当它用autoreverse完成动画时,successview成为alpha 1.00 ...为什么?
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:2];
[UIView setAnimationRepeatAutoreverses:YES];
[successView setAlpha:1.00];
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
一种方法是做两种不同的动画:一种向alpha值1.0前进,然后另一种从1.0回到0.
使用animateWithDuration:animations:completion:方法UIView来完成此任务.您可以在完成块中执行相反的操作.
有点像:
[UIView animateWithDuration:0.2
animations:^{view.alpha = 1.0;}
completion:^(BOOL finished){
[UIView animateWithDuration:0.2
animations:^{view.alpha = 0;}];
}];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2446 次 |
| 最近记录: |