我们通过调用返回返回键数组的[filter inputKeys]来获取CIFilter的输入键。是否有建议的方法在运行时确定特定键的输入参数类型?
最佳答案
有了输入键,您可以将其用作属性字典的键,该字典应为每个输入键传递一个类型信息:
for( NSString* inputKey in filter.inputKeys )
{
NSDictionary *attribute = filter.attributes[inputKey];
NSString *inputKeyClassName = attribute[kCIAttributeClass];
NSLog(@"%@: %@", inputKey, inputKeyClassName);
}
CIColorControl的输出:
2013-05-13 23:30:27.615 cifilter[7918:303] inputImage: CIImage
2013-05-13 23:30:27.616 cifilter[7918:303] inputSaturation: NSNumber
2013-05-13 23:30:27.616 cifilter[7918:303] inputBrightness: NSNumber
2013-05-13 23:30:27.616 cifilter[7918:303] inputContrast: NSNumber
关于ios - CIFilter在运行时确定inputKey参数类型,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16531173/