如何在iPhone中制作像地图应用一样的半卷曲动画?

发布于 2024-09-01 17:22:37 字数 314 浏览 5 评论 0原文

我正在使用以下代码进行页面卷曲动画

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

是否可以制作像 iphone/ipod 上的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 ?

Any ideas how to make an similar effect ?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

七色彩虹 2024-09-08 17:22:37

从 3.2 开始,Apple 确实支持模态视图的呈现。这是有道理的:卷页效果旨在向用户发出信号,表明正在显示选项或设置页面,并且当他们完成更改后,它们将被发送回原始视图。 Apple 不希望动画推断出页面层次结构正在进行的更改,而只是一种必须返回其起始位置的模态更改。

使用起来非常简单;只需确保您从全屏视图开始,并使用 UIModalPresentationFullScreen 样式加载,我认为这是默认样式。

通常在 UIView 4.0 中添加的动画过渡可以使用类似的效果,但这是使用该效果的直接方法。

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

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

关于 UIModalTransitionStyle 常量的 Apple 文档链接

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

宫墨修音 2024-09-08 17:22:37

我也一直在研究这个问题,并在短期内决定将其 PNG 版本放置在按钮内,并使用卷曲来显示动画。我的解决方案中唯一缺少的就是能够像在地图中那样与冰壶页面交互(播放)。

方法

首先,我根据地图的屏幕截图在 Photoshop 中创建了一个页面角 PNG。

地图卷曲 PNG

Page Curl PNG

地图 - 隐藏选项

Map Curl - 地图

地图 - 选项显示

Map Curl - 选项显示

然后,我将其添加到执行部分页面卷曲过渡的 UIButton 中。

完整的源代码可在 GitHub 上获取

完整的工作项目可在 GitHub 上获取。针对 iPhone 5 进行了更新。

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.

爱格式化 2024-09-08 17:22:37

使用未记录的动画类型 mapCurlmapUnCurl

Use the undocumented animation types mapCurl and mapUnCurl

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文