### 为啥UIView动画结束函数被调用了两次?
### 为什么UIView动画结束函数被调用了两次??
animationStopped一开始就被调用了,然后5秒后又被调用一次??
------解决方案--------------------
你设置了委托就别再手动添加一个委托了,[UIView setAnimationDidStopSelector:@selector(animationStopped)];这句不要。找找动画停止的委托。
或者不要这句[UIView setAnimationDelegate:self];
- C/C++ code
[UIView beginAnimations:@"fadeOut" context:nil]; [UIView setAnimationDuration:5.0]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(animationStopped)]; self.alpha = 0.0; [UIView commitAnimations];
animationStopped一开始就被调用了,然后5秒后又被调用一次??
------解决方案--------------------
你设置了委托就别再手动添加一个委托了,[UIView setAnimationDidStopSelector:@selector(animationStopped)];这句不要。找找动画停止的委托。
或者不要这句[UIView setAnimationDelegate:self];