How to make half curl animation in iPhone like the

2019-01-14 04:58发布

I am using the following code for page curl animation

[UIView beginAnimations:@"yourAnim" context:nil];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:yourView cache:cacheFlag];
...
[UIView commitAnimations];

Is it possible to make the half curl animation like the maps.app on iphone/ipod ?

Any ideas how to make an similar effect ?

Thanks

3条回答
三岁会撩人
2楼-- · 2019-01-14 05:23

Apple does support this for the presentation of modal views as of 3.2. This makes sense: the page curl effect is intended to signal the user that a page of options or settings is being revealed, and when they are done changing things, they will be sent back to the original view. Apple doesn't want the animation to infer an ongoing change to the page hierarchy, just a modal one that must return to its starting place.

It's pretty straightforward to use; just be sure that you are starting from a full screen view, and loading with the UIModalPresentationFullScreen style, which I believe is the default.

There are animation transitions to use a similar effect in UIViews generally that were added as of 4.0, but this is a straightforward way to use the effect.

simpleVC * myModalVC = [[simpleVC alloc] init];
[myModalVC setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[myModalVC setDelegate:self];

[self presentModalViewController:myModalVC animated:YES];
[simpleVC release];

Link to Apple Docs on UIModalTransitionStyle constants

查看更多
做个烂人
3楼-- · 2019-01-14 05:25

Use the undocumented animation types mapCurl and mapUnCurl

查看更多
Bombasti
4楼-- · 2019-01-14 05:30

I too have been working on this issue and I settled in the short term on a PNG version of it placed within a button and using the curl to reveal animation. The only thing missing in my solution is the ability to interact (play) with the curling page the way you can in Maps.

The Method

First, I created a Page corner PNG in Photoshop based on a screenshot of Maps.

The Map Curl PNG

Page Curl PNG

The Map - Options Hidden

Map Curl - Map

The Map - Options Revealed

Map Curl - Options Reveal

Then, I added it to a UIButton that does a partial page curl transition.

Complete Source Code Available on GitHub

The complete working project is available at GitHub. Updated for iPhone 5.

查看更多
登录 后发表回答