核心动画:如何使页面翻转过渡?

时间:2009-12-28 14:37:42

标签: iphone core-animation

我想为iPhone应用创建一个页面翻转过渡,如笔记中的那个。基本上当你转到一个新的视图时,页面的底部或顶部会像你翻书的页面一样卷曲。

任何人都知道有关如何执行此操作的教程吗?

3 个答案:

答案 0 :(得分:7)

[UIView beginAnimations:@"pageCurlUp" context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:someUIView cache:YES];
[UIView commitAnimations];

还要在文档中查找UIViewAnimationTransition

答案 1 :(得分:3)

Xcode提供了一个模板来创建实用程序应用程序,其中有一个Info按钮和一个侧视图。您可能想要查看此模板。

您可以通过将控制器的modelTransitionStyle设置为UIModelTransitionStyleFlipHorizo​​ntal

来执行相同操作
FlipsideViewController *controller = [[FlipsideVewController alloc] initWithNibName:@"FlipsideView" bundle:nil];

controller.modelTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModelViewController: controller animated:YES];

[controller release];

答案 2 :(得分:-1)

尝试下一个和上一个音符翻转动画

CATransition *transition = [CATransition animation];
        [transition setDelegate:self];
        [transition setDuration:0.5f];
        [transition setType:@"pageCurl"];
        [transition setSubtype:@"fromBottom"];
        [self.view.layer addAnimation:transition forKey:@"CurlAnim"];


     CATransition *transition = [CATransition animation];
                        [transition setDelegate:self];
                        [transition setDuration:0.5f];
                        [transition setType:@"pageUnCurl"];
                        [transition setSubtype:@"fromBottom"];
                        [self.view.layer addAnimation:transition forKey:@"CurlAnim"];