使用转换CIFilter进行CATransition [英] Using transition CIFilters for CATransition

查看:153
本文介绍了使用转换CIFilter进行CATransition的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用新的iOS 6过渡动画(CIBarsSwipeTransition,使用 CATransition 过滤器属性CICopyMachineTransition等)。 CIFilter 文档说这些在iOS 6上可用,而且 CATransition documentation 表示无法使用过滤器属性。

I'm trying to use CATransition's filter property with the new iOS 6 transition animations (CIBarsSwipeTransition, CICopyMachineTransition, etc.). The CIFilter documentation says that these are available on iOS 6, and nothing on the CATransition documentation says that the filter property cannot be used.

但是,我似乎无法得到它们上班。我不知道Apple是否只是没有提到功能的可用性,或者我只是错过了让它工作的东西。以下是我如何设置它:

But, I can't seem to get them to work. I don't know if Apple just failed to mention the inavailability of the functionality or I'm just missing something to make it work. Here's how I set it up:

CIFilter *transitionFilter = [CIFilter filterWithName:@"CIBarsSwipeTransition"];
[transitionFilter setDefaults];

CATransition *transition = [CATransition new];
transition.duration = 0.4f;
transition.filter = transitionFilter;

[self.view.layer addAnimation:transition forKey:kCATransition];

任何指针都表示赞赏。

推荐答案

我不确定在iOS上是否可行。从CATransition文档:

I'm not sure it is possible on iOS. From the CATransition documentation:


如果指定,过滤器必须同时支持 kCIInputImageKey kCIInputTargetImageKey 输入键,以及 kCIOutputImageKey 输出键。

If specified, the filter must support both kCIInputImageKey and kCIInputTargetImageKey input keys, and the kCIOutputImageKey output key.

来自 CIFilter文档(常量部分)(强调我的)

From the CIFilter documentation (constants section) (emphasis mine)


kCIInputTargetImageKey

CIImage对象的一个​​键,它是转换的目标图像。
适用于OS X v10.5及更高版本。 在iOS无法使用

A key for a CIImage object that is the target image for a transition. Available in OS X v10.5 and later. Not available in iOS.

过滤器存在, inputTargetImage 是输入键之一,但即使您自己创建核心图像数据并将其分配给属性(在调试器中正确显示),您仍然无法获得效果。

The filter exists, and inputTargetImage is one of the input keys, but even if you create the core image data yourself and assign it to the properties (which displays properly in the debugger) then you still don't get the effect.

在OS X上创建相同的效果就像问题中的代码一样简单。我已将此作为雷达(13281399)提交。

Creating the same effect on OS X is as simple as the code in your question. I have filed this as a radar (13281399).

这篇关于使用转换CIFilter进行CATransition的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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