Incompatible pointer types sending 'UIImageView' to parameter of type 'UIImage*' (xcode5)
我在此代码行中收到错误:
1 | GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:_imagView]; |
这是错误:
1 | Incompatible pointer types sending 'UIImageView' to parameter of type 'UIImage*' |
有人知道我该怎么做吗?
背景:
UIImageView用于在视图层次结构中显示UIImage。 UIImage是图像; UIImageView是绘制它的对象,因此它包括其在视图控制器上的位置,如何拉伸它,z顺序,alpha等。还有其他显示图像的方法,如果您编写自己的UIView,可能会用到 子类。
眼前的问题:
UIImageView不是UIImage。 不过,UIImageView具有UIImage,因此您可以使用以下代码:
1 | GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:_imageView.image]; |
问题
传递参数UIImageView而不是UIImage
解
将代码更改回:
1 | GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:_imagView.image]; |