开发者

Core Animation: How to make a page flipping transition?

开发者 https://www.devze.com 2022-12-15 11:44 出处:网络
I want to create a page flipping transition for an iPhone app like the one in notes. Basically when you go to a new view the bottom or top of th开发者_JAVA技巧e page curls like if you were turning the

I want to create a page flipping transition for an iPhone app like the one in notes. Basically when you go to a new view the bottom or top of th开发者_JAVA技巧e page curls like if you were turning the page of a book.

Anyone know of a tutorial on how to do this?


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

Also look for UIViewAnimationTransition in documentation.


Xcode provides a template to create an utility application, in which there is a Info button, and a flipside view. You might want to have a look at this template.

You can do the same by setting the modelTransitionStyle of the controller to UIModelTransitionStyleFlipHorizontal

FlipsideViewController *controller = [[FlipsideVewController alloc] initWithNibName:@"FlipsideView" bundle:nil];

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

[controller release];


Try this for next and previous note flip animation

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"];
0

精彩评论

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