首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

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

2012-12-31 
###为什么UIView动画结束函数被调用了两次??[UIView beginAnimations:@fadeOut context:nil][UIView se

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

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

热点排行