暧昧地使用'init(CIImage :)'

时间:2017-05-31 22:49:17

标签: swift

我在最后一行有一个错误 - Ambigous use of 'init(CIImage:)'。任何人都可以帮我解决这个问题吗?

let origImage = CIImage(image: img)
let filter = CIFilter(name: "CIColorInvert")
filter?.setValue(origImage, forKey: kCIInputImageKey)
let invertedImage = UIImage(CIImage: (filter?.outputImage)!)

1 个答案:

答案 0 :(得分:2)

在Swift 3中,UIImage(CIImage: ...)构造函数被重命名为:

let invertedImage = UIImage(ciImage: ...)