如何实现UIView的翻转过渡效果
如何实现 UIView 的翻转过渡效果,就像“flipboard”应用程序中的那样。这里我已经有可以从左到右或从右到左翻转的示例。但这里我想实现从下到上或从上到下的折叠翻转。
How to implement flip transition effect for UIView as like in "flipboard" application. here i already have sample which will make flip from left to right or right to left. But here i want to implement fold flip from bottom to top or top to bottom.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用下面的代码行来实现这种动画,
您可以根据要求设置持续时间和动画过渡..仅在ios5中工作..
you can use the below line of codes for this kind of animations
u can set the duration and animation transition as per the requirement.. was working only in ios5..
检查本教程: http://www.gethugames.in/blog/2012 /02/extended-epgltransitionview.html
这个项目: https://github.com/saiy2k/EPGLTransitionView
PS:这是我自己的博客和链接到我的 EPGLTransitionView 分支
check this tutorial: http://www.gethugames.in/blog/2012/02/extended-epgltransitionview.html
and this project: https://github.com/saiy2k/EPGLTransitionView
PS: Its my own blog and link to my fork of EPGLTransitionView
这是我如何尝试解决该问题的一个概念。也许我会尝试在空闲时间实现它以方便使用示例。
UIView
的大小,以便它们弥补要翻转的视图的两半,右半部分的区域有两个视图drawRect:
实现我认为您可以使用一个带有三个 CALayer 的 UIView,而不是这三个 UIView。
并且存在一个以交互方式进行转换的问题,即用户在页面上滑动手指。
我还认为存在双面层的翻转视图问题。还没有机会体验这些属性以及它们可以帮助实现的目标。
另一种解决方案是从 UIView 的内容创建纹理,并在其上放置一个 OpenGL 表面(当然是基于 alpha 透明的 CAEAGLLayer 的表面)。然后,您将如何处理带有该图像纹理的三角形,仅受您的想象力的限制。我想这也将允许创建 Mail iOS 应用程序使用的类似精灵的移动到垃圾箱的动画。
编辑:哦,抱歉,我正在考虑从右到左的翻转板式翻转,而不是从上到下,但总体思路当然是相同的。
Here's a concept of how I would try to approach the problem. Maybe I'll try to implement it in free time to have a sample handy.
UIView
s with sizes so that they make up for two halves of the view to be flipped, with two views for area of the right halfdrawRect:
implementationsI think that instead of those three UIViews you could use one UIView with three CALayers instead.
And there's an issue of doing the transition interactively, with the user sliding his finger over the pages.
I also I think there's an issue of the flipping view to have a two-sided layer. Haven't had the opportunity to play with those properties and what they can help to achieve.
Another solution would be to create a texture from UIView's contents and put up an OpenGL surface over it (alpha-transparent
CAEAGLLayer
-based one of course). Then what you'll do with the triangles that are textured with that image is only limited by your imagination. I guess that would also allow to create a Genie-like move-to-trash animation that Mail iOS app uses.Edit: Oh, sorry, I was thinking of a right-to-left flipboard-style flip, not top-to-bottom, but overall idea is the same of course.