开发者

How to make half curl animation in iPhone like the maps app?

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 animat开发者_JAVA技巧ion like the maps.app on iphone/ipod ?

Any ideas how to make an similar effect ?

Thanks


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


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

How to make half curl animation in iPhone like the maps app?

The Map - Options Hidden

How to make half curl animation in iPhone like the maps app?

The Map - Options Revealed

How to make half curl animation in iPhone like the maps app?

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.


Use the undocumented animation types mapCurl and mapUnCurl

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜