开发者

how to add flip screen animation on button click programmatically

开发者 https://www.devze.com 2023-02-26 05:15 出处:网络
I want to flip the view on button click prog开发者_如何学Crammatically.Use + (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimat

I want to flip the view on button click prog开发者_如何学Crammatically.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消