Question

I have 2 identical views on top of each other. One is a real one and one is supposed to act as a dummy.

I'd like to crossfade between them (silently). I set one view's alpha to 0 and second view's alpha to 1 simultaneously in the same animation block.

But the results are not smooth and I'm able to see one view is fading out while the second one is fading in. I'd like this animation to be silent (i.e without any animation at all).

P.S. I cannot just set those alphas without any animation, because the real view is a part of the collection view which has to fade out and the second view (dummy) supposes to substitute one of collection view's cells after the collection view is gone.

Any way to do it and why iOS renders it that way?

Thanks!

Was it helpful?

Solution

Try:

[UIView transitionFromView:view1 toView:view2 duration:0.5
                       options:UIViewAnimationOptionTransitionCrossDissolve
                    completion:^(BOOL finished) {
        // Compeltion code
    }];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top