0

is it possible to flip a UIView about the x or y axes, such that it flips entirely over and you can see the "backside" of the view? I gather that UIKit is based on OpenGL ES, and so there is the question of whether they implemented layers using two-sided triangles...

Friendly
  • 233
  • 1
  • 7

1 Answers1

2

To flip into a view controller:

viewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:viewController animated:YES completion:nil];

To flip out of it:

[self dismissViewControllerAnimated:YES completion:nil];

If you want to flip only views you can put the two views you want to flip inside an unnamed view with the same size and link the IBOutlet UIView *newView,*oldView; to the views and put the new view on top

bool a = NO;

@implementation ViewController

- (IBAction)flip:(id)sender 
{
    if (a == NO) {
        [UIView transitionFromView:oldView toView:newView  
                  duration:1.0 
                  options:UIViewAnimationOptionTransitionFlipFromLeft 
                  completion:NULL];
        a = YES; // a = !a;
    }
    else {
        [UIView transitionFromView:newView toView:oldView  
                  duration:1.0 
                  options:UIViewAnimationOptionTransitionFlipFromLeft 
                  completion:NULL];
        a = NO; // a = !a;
    }
}

Source: How to flip an individual UIView (without flipping the parent view)


You can check this awesome custom controllers:

Community
  • 1
  • 1
Vlad Z.
  • 3,401
  • 3
  • 32
  • 60