neel
neel

Reputation: 209

how to add flip screen animation on button click programmatically

I want to flip the view on button click programmatically.

Upvotes: 0

Views: 748

Answers (2)

Satya
Satya

Reputation: 3330

Please find the following code

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:[self view] cache:YES];
[[self view] addSubview:secondaryView];
[UIView commitAnimations];

Please write the above code in the button action.

In the code second view refers, the view which you want to show after flip.

Upvotes: 1

McCygnus
McCygnus

Reputation: 4215

Use + (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion with UIViewAnimationOptionTransitionFlipFromRight or UIViewAnimationOptionTransitionFlipFromLeft for the options parameter.

Upvotes: 1

Related Questions