简体   繁体   English

如何在iPhone中制作半卷曲动画,如地图应用程序?

[英]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 animation like the maps.app on iphone/ipod ? 是否有可能像iphone / ipod上的maps.app一样制作半卷曲动画?

Any ideas how to make an similar effect ? 任何想法如何产生类似的效果?

Thanks 谢谢

Apple does support this for the presentation of modal views as of 3.2. 从3.2开始,Apple确实支持这种模式视图的呈现。 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. Apple不希望动画推断出对页面层次结构的持续更改,只是一个必须返回其起始位置的模式。

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. 只需确保您从全屏视图开始,并加载UIModalPresentationFullScreen样式,我认为这是默认设置。

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. 有一些动画过渡在UIViews中使用类似的效果,通常是从4.0开始添加的,但这是使用效果的简单方法。

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 链接到UIModalTransitionStyle常量上的Apple Docs

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. 我也一直在研究这个问题,我在短期内确定了PNG版本,它放在一个按钮内并使用curl来显示动画。 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. 首先,我根据地图的截图在Photoshop中创建了一个Page corner PNG。

The Map Curl PNG 地图卷曲PNG

Page Curl PNG

The Map - Options Hidden 地图 - 选项隐藏

地图卷曲 - 地图

The Map - Options Revealed 地图 - 选项显示

Map Curl  - 选项显示

Then, I added it to a UIButton that does a partial page curl transition. 然后,我将它添加到执行部分页面卷曲转换的UIButton。

Complete Source Code Available on GitHub 完整的源代码可在GitHub上获得

The complete working project is available at GitHub . 完整的工作项目可在GitHub上获得 Updated for iPhone 5. 针对iPhone 5进行了更新。

使用未记录的动画类型mapCurlmapUnCurl

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM