如何复制 Mail.app 的垃圾动画 [英] How can I replicate the trashing animation of Mail.app

查看:24
本文介绍了如何复制 Mail.app 的垃圾动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 iPhone 应用程序中,我在 UIToolBar 中放置了一个 UIBarButtonSystemItemTrash 类型的 UIBarBUtton.当按下时,我想复制 Mail.app 的动画:垃圾箱打开,UIView 折叠并飞入其中.
有没有办法通过 iPhone SDK 访问这个动画?

In my iPhone app, I have put a UIBarBUtton of type UIBarButtonSystemItemTrash in my UIToolBar. When pressed, I'd like to replicate the animation of Mail.app: the bin opens, the UIView folds and flies into it.
Is there a way to access this animation ithrough the iPhone SDK?

目前我使用的是定制动画,但有一些限制;例如,我无法为垃圾箱本身设置动画.你有什么建议吗?代码示例?

Presently I am using a custom made animation, but there are some limits; for example, I cannot animate the bin itself. Do you have any suggestion? Code samples?

干杯,
大卫

推荐答案

在动画上使用suckEffect 类型.另外:spewEffect、genieEffect、unGenieEffect、twist、tuby、swirl、cameraIris、cameraIrisHollowClose、cameraIrisHollowOpen、rippleEffect、charminUltra、zoomyIn 和 zoomyOut.在模拟器中不起作用.

Use the suckEffect type on an animation. Also: spewEffect, genieEffect, unGenieEffect, twist, tubey, swirl, cameraIris, cameraIrisHollowClose, cameraIrisHollowOpen, rippleEffect, charminUltra, zoomyIn, and zoomyOut. Doesn't work in the simulator.

CATransition *animation = [CATransition animation];
animation.type = @"suckEffect";
animation.duration = 2.0f;
animation.timingFunction = UIViewAnimationCurveEaseInOut;
view.opacity = 1.0f;
[view.layer addAnimation:animation forKey:@"transitionViewAnimation"];

注意:代码片段是从更大的代码库中提取的.我希望它有效:)

Note: Code snippet was pulled from a larger codebase. I hope it works :)

这篇关于如何复制 Mail.app 的垃圾动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆