我正在为 AVMutableVideoComposition
创建一个 CIFilter
由于它不支持过滤器和图层指令,我尝试直接在过滤器中应用我需要的转换:
filter.setValue(transform, forKey: kCIInputTransformKey)
transform
是一个 CGAffineTransform
这会抛出异常
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key inputTransform.'
现在医生说
A key for an NSAffineTransform object that specifies a transformation to apply.
但是 NSAffineTransform
在 iOS 上不存在。
如何使用 CGAffineTransform
或 iOS,或者有什么替代品可以替代它?
最佳答案
您需要将转换包装在 NSValue
中:
filter.setValue(NSValue(cgAffineTransform: transform), forKey: kCIInputTransformKey)
关于ios - 如何在 iOS 上使用 kCIInputTransformKey,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54452378/