开发者

Iphone flip views using block animation methods

开发者 https://www.devze.com 2023-01-29 12:18 出处:网络
Hi I have looked without success for the answer to this. Am trying to flip views o开发者_如何学JAVAn iphone app. Rather than using the usual iOS3 methods I want to use block methods to animate the tra

Hi I have looked without success for the answer to this. Am trying to flip views o开发者_如何学JAVAn 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?


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
                }
 ];


[UIView animateWithDuration:0.5
                      delay:0.0 
                    options:UIViewAnimationOptionTransitionFlipFromLeft 
                 animations:^{
                                 // Exchange the views here
                                 [view1 removeFromSuperview];
                                 [mySuperview addSubview:view2]; 
                             }
                 completion:NULL];
0

精彩评论

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