他们是怎么做到的? [iPhone布局]
查看此应用程序:
如果您在主图像(黑色鞋子)中向左滑动,您可以看到另一张图像。
任何人都可以尝试这个应用程序(Fashiolista,它是免费的,不需要注册)并且 你说我怎样才能做出这样的效果?
谢谢你们。
checkout this app:
If you swipe left in main image (the black shoes) you can see another image.
Can anyone try this app (Fashiolista, it's free and signup isn't required) and
say me how can I do an effect like that?
Thank you guys.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我还没有尝试过该应用程序,但通常实现此目的的方式是使用
UIScrollView
。为了使滑动操作按预期工作,您必须将pagingEnabled
设置为YES
。实现这样的事情最困难的部分是处理有限的系统资源:你很快就会耗尽内存。因此,您必须实现一个类似于 UITableView 中使用的排队系统。 GitHub 上有一些此类项目,但我建议查看 Apple 的开发资源;我不记得链接了,但我相信在上一届 WWDC 材料中,他们提供了有关如何正确构建此链接的信息。
I've not tried the app, but the way you usually accomplish that is with
UIScrollView
. In order to get the swiping-action to work as expected, you have to setpagingEnabled
toYES
.The hardest part of implementing something like this is handling limited system resources: you'll run out of memory really quick. So you have to implement a queuing system rather like that used in
UITableView
. There are a few projects of this sort on GitHub, but I recommend checking out Apple's dev resources on this; I don't remember the link, but I believe in the last WWDC materials, they had info on how to build this properly.他们似乎正在使用核心动画来修改图像的 Alpha 并对图像进行动画处理。
查看 核心动画编程指南简介。
*编辑:
他们也可以使用 UIViews 动画 API。这可能更简单。
查看编程指南 - 动画
They seem to be using Core Animation to modify the images' alpha and animate the images out and in.
Check out Introduction to Core Animation Programming Guide.
*edit:
They could also be using UIViews animation API. This is probably even simpler.
View Programming Guide - Animations
看起来他们正在降低内容的不透明度,因为它使用核心动画滚动并缓和过渡
Looks like they are lowering the opacity of the content as it scrolls of using core animation and ease out transition