Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Iphone flip views using block animation methods

Hi I have looked without success for the answer to this. Am trying to flip views on iphone app. Rather than using the usual iOS3 methods I want to use block methods to animate the transition. Can anyone suggest a snippet of code to help please?

like image 300
zed111 Avatar asked Nov 22 '25 09:11

zed111


2 Answers

I tried the animateWithDuration method suggested above, and it didn't work. I couldn't get it working until I used the following:

[UIView transitionFromView:viewOld 
                    toView:viewNew
                  duration:.75 
                   options:UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationCurveEaseIn 
                completion:^(BOOL finished)
                {
                    // cleanup viewOld
                }
 ];
like image 158
paiego Avatar answered Nov 24 '25 22:11

paiego


[UIView animateWithDuration:0.5
                      delay:0.0 
                    options:UIViewAnimationOptionTransitionFlipFromLeft 
                 animations:^{
                                 // Exchange the views here
                                 [view1 removeFromSuperview];
                                 [mySuperview addSubview:view2]; 
                             }
                 completion:NULL];
like image 27
Ole Begemann Avatar answered Nov 24 '25 23:11

Ole Begemann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!