自定义ImageView不显示图片
Custom ImageView doesn't display image
我已经在自定义 imageView 上创建了 class。并试图覆盖图像 setter 方法。但是由于某种原因,imageView 没有显示任何内容,尽管图像正在分配给它。
代码如下:
@implementation CustomImageView
@synthesize image = _image;
- (void)setImage:(UIImage *)correctedImage
{
_image = correctedImage;
}
@end
我试过删除 setter 方法。即根本不覆盖任何方法。它仍然没有显示任何东西。 :(
问题是我必须通过将图像传递给 super 来设置图像。
[super setImage: correctedImage];
简单地说,从基础 class 开始设置它似乎不起作用:/
我已经在自定义 imageView 上创建了 class。并试图覆盖图像 setter 方法。但是由于某种原因,imageView 没有显示任何内容,尽管图像正在分配给它。
代码如下:
@implementation CustomImageView
@synthesize image = _image;
- (void)setImage:(UIImage *)correctedImage
{
_image = correctedImage;
}
@end
我试过删除 setter 方法。即根本不覆盖任何方法。它仍然没有显示任何东西。 :(
问题是我必须通过将图像传递给 super 来设置图像。
[super setImage: correctedImage];
简单地说,从基础 class 开始设置它似乎不起作用:/