首页 > 关于UIView动画的一个问题,求助!

关于UIView动画的一个问题,求助!

我想做一个闪烁的动画,通过UIView的Alpha值,代码如下,为什么消失的时候是动画,显示却直接出现了?动画不平滑。

[UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionRepeat animations:^{
        if (aView.alpha == 0) {
            [aView setAlpha:0.5];
        }else if (middle.alpha == 0.5){
            [middle setAlpha:0];
        }
} completion:^(BOOL finished) {

}];

在StackOverflow上提问并找到了答案:http://stackoverflow.com/questions/17848031/with-uiview-block-animation-do-flashing-effect?noredirect=1#comment26055042_17848031

options使用 UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse即解决问题!

【热门文章】
【热门文章】