ios - 在 GPUImageView 上找不到方法 "setImage:"

标签 ios uiimageview gpuimage

我将在 GPUImageView 上设置图像。

UIImage *adjustedImage = [lookupFilter imageFromCurrentFramebufferWithOrientation:0];
[self->_imgView setImage:adjustedImage];

但是在GPUImageView类中是没有setImage:方法的。 有人可以发布 setImage: 的整个方法或者告诉我如何找到这个方法吗? 我想我可以从 UIImageView.m 文件中复制方法并将其粘贴到 GPUImageView.m 文件中。但是我找不到 UIImageView.m 文件。

GPUImageView.h

#import <UIKit/UIKit.h>
#import "GPUImageContext.h"

typedef enum {
    kGPUImageFillModeStretch,                       // Stretch to fill the full view, which may distort the image outside of its normal aspect ratio
    kGPUImageFillModePreserveAspectRatio,           // Maintains the aspect ratio of the source image, adding bars of the specified background color
    kGPUImageFillModePreserveAspectRatioAndFill     // Maintains the aspect ratio of the source image, zooming in on its center to fill the view
} GPUImageFillModeType; 

/**
 UIView subclass to use as an endpoint for displaying GPUImage outputs
 */
@interface GPUImageView : UIView <GPUImageInput>
{
    GPUImageRotationMode inputRotation;
}

/** The fill mode dictates how images are fit in the view, with the default being kGPUImageFillModePreserveAspectRatio
 */
@property(readwrite, nonatomic) GPUImageFillModeType fillMode;

/** This calculates the current display size, in pixels, taking into account Retina scaling factors
 */
@property(readonly, nonatomic) CGSize sizeInPixels;

@property(nonatomic) BOOL enabled;

/** Handling fill mode

 @param redComponent Red component for background color
 @param greenComponent Green component for background color
 @param blueComponent Blue component for background color
 @param alphaComponent Alpha component for background color
 */
- (void)setBackgroundColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent alpha:(GLfloat)alphaComponent;

- (void)setCurrentlyReceivingMonochromeInput:(BOOL)newValue;

@end

最佳答案

GPUImageView 不是 UIImageView 的子类。它没有 -setImage: 方法。您没有为其设置 UIImages 。它不是那样工作的。

GPUImageView 是您的过滤器链的目的地。要在其中显示图像,您可以将 GPUImageView 设置为您的 GPUImagePicture 实例或后续过滤器的目标(如果您想要显示过滤后的输出)。您没有将 UIImage 设置为该 View 的内容。同样,它不是 UIImageView。

有很多示例说明如何将 GPUImageView 与 GPUImage 附带的示例一起使用。我还在我的项目文档中解释了这是如何工作的。请在继续之前检查一下。

关于ios - 在 GPUImageView 上找不到方法 "setImage:",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23712718/

相关文章:

ios - AppDelegate 的 ViewController 内的 Preform 函数

objective-c - UIImageView焦点效果

iphone - ios 旋转后图像边框变得模糊

ios - GPUImage:2个分支链的同步

ios - 如何使用 GPUImageHarrisCornerDetectionFilter 检测图像的角点

ios - 如何从异步属性的 getter 返回?

ios - 默认游戏中心 View Controller 中的成就顺序

ios - 选择单元格时,UITableViewCell 中的 UIImageView 未突出显示

ios - "libRestKit.a, file was built for archive which is not the architecture being linked (armv7)"

iphone - UIGestureRecognizer在<OS3.2上崩溃