2

My question is very similar to this one:

Seamlessly flip from one modal view to another, without showing a solid colour background

I followed the advice and ran into the same problem with the suggested solution - the entire screen flips, not just the modal. I had given up on this being possible, until the designer here showed me an example from the Pinterest app. I'm including an animated gif here. You can see that the background (with the 'x' close button) does not flip. Any ideas how this could be done?

Thanks!

enter image description here

1 Answer 1

6

This is in fact quite easy to achieve using simple UIView animations:

[UIView transitionWithView:viewToAnimate
                  duration:0.3
                   options:UIViewAnimationOptionTransitionFlipFromLeft
                animations:^{
                    // TODO: Animations here
                    viewToHide.hidden = YES;
                    viewToShow.hidden = NO;
                }

As you may note, the key here for the flip is the option UIViewAnimationOptionTransitionFlipFromLeft. Use it along with UIViewAnimationOptionTransitionFlipFromRight to obtain the same result that you are seeing in the GIF.

Only the viewToAnimate and its contents will flip, everything outside its hierarchy will stay still.

1
  • Sorry for the slow response. This is exactly what I needed to know thanks!!
    – fogwolf
    Commented Sep 6, 2013 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.