Iphone 未调用UIImage方法

Iphone 未调用UIImage方法,iphone,ios,Iphone,Ios,我试图在视图上操纵UIImage对象。但当我试图调用UIImage类上的任何方法时,它抛出异常 2013-02-14 15:24:42.301 Test[4685:19a03] -[UIImage scaleToSize:]: unrecognized selector sent to instance 0x94642c0 2013-02-14 15:24:42.303 Test[4685:19a03] *** Terminating app due to uncaught exception

我试图在视图上操纵UIImage对象。但当我试图调用UIImage类上的任何方法时,它抛出异常

2013-02-14 15:24:42.301 Test[4685:19a03] -[UIImage scaleToSize:]: unrecognized selector sent to instance 0x94642c0 
2013-02-14 15:24:42.303 Test[4685:19a03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage scaleToSize:]: unrecognized selector sent to instance 0x94642c0'
*** First throw call stack:`
(0x1cc1012 0x1ae6e7e 0x1d4c4bd 0x1cb0bbc 0x1cb094e 0x47ee9 0x47bc0 0xb0f817 0xb0f882 0xb0fb2a 0xb26ef5 0xb26fdb 0xb27286 0xb27381 0xb27eab 0xb27fc9 0xb28055 0xc2d3ab 0xa7e92d 0x1afa6b0 0x5c3fc0 0x5b833c 0x5b8150 0x5360bc 0x537227 0x5378e2 0x1c89afe 0x1c89a3d 0x1c66f61 0x1c66e1b 0x39117e3 0x3911668 0xa2e65c 0x31fcd 0x29d5)
libc++abi.dylib: terminate called throwing an exception
以下是我正在使用的代码:

 UIImage *test = [[UIImage alloc] init];
    test = [UIImage imageNamed:@"image0.jpg"];
    [test scaleToSize:CGSizeMake(40.0f, 40.0f)];

首先定义图像大小,然后缩放它

UIImage *test = [[UIImage alloc] init;
test = [UIImage imageNamed:@"image0.jpg"];
[test scaleToSize:CGSizeMake(40.0f, 40.0f)];
请尝试这行代码。或者在UIImageView中使用此图像查看。你找不到你想要的方法。可能您忘记添加正在使用的类别,例如:


UIImage未实现scaleToSize:方法。您试图使用的某些第三方库可能是?删除scaleToSize,因为UIImages不支持它。您没有在
scaleToSize
行上收到警告吗?是的,我正在使用第三方库过滤器:。粘贴scaleToSize的代码。。问题在于
scaleToSize
。它未在UIImage中实现。请将其用于image.transform=CGAffineTransformMakeScale(2,2);我再次说了
#导入“UIImage+Scale.h”
,只是想给你一个可能的类别的例子,让你可以缩放
UIImage
s。。。
#import "UIImage+Scale.h"