문제

I want a flashing animation, Alpha value through UIView the code below, why disappear when the animation display has a direct emerged? Animation is not smooth.

[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) {

}];
도움이 되었습니까?

해결책

When doing a repeating animation, you can often produce a more graceful animation if you use UIViewAnimationOptionAutoreverse when using UIViewAnimationOptionRepeat.

By adding the autoreverse option, that prevents the jarring UI that results otherwise, where it gracefully animates from the starting state to the end state, but then jumps back to the starting state before repeating the process. By using UIViewAnimationOptionAutoreverse, it gracefully animates back to the start state before repeating the animation.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top