在 iOS 10 上从 CIImage 创建 UIImage

Por*_*wal 2 objective-c uiimage ios titanium-modules appcelerator-titanium

我试图为 iOS10 重建一个钛模块(https://github.com/Exygy/Titanium-Ti.Barcode

重建时,我收到以下错误并且构建失败。

cannot initialize a variable of type 'UIImage *' with an rvalue of type
  'CIImage *'
UIImage *image = [blob image];
         ^       ~~~~~~~~~~~~
Run Code Online (Sandbox Code Playgroud)

以下是生成它的代码段:

id blob = [args valueForKey:@"image"];
ENSURE_TYPE(blob, TiBlob);
UIImage* image = [blob image];
Run Code Online (Sandbox Code Playgroud)

我是 Objective C 的菜鸟。

Dar*_*ana 5

您可以使用以下内容:

目标 C:

CIImage *ciImage = [blob image];
UIImage *uiImage = [[UIImage alloc] initWithCIImage:ciImage];
Run Code Online (Sandbox Code Playgroud)

斯威夫特 4.0:

let ciImage: CIImage? = blob.image()
let uiImage = UIImage(ciImage: ciImage!)
Run Code Online (Sandbox Code Playgroud)