读书人

### 为啥UIView动画结束函数被调用

发布时间: 2012-07-18 12:05:41 作者: rapoo

### 为什么UIView动画结束函数被调用了两次??

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];

读书人网 >Iphone

热点推荐