我想操縱視圖上的UIImage對象。但是,當我嘗試調用上的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沒有實現scaleToSize:方法。你正嘗試使用一些第三方庫可能? – Vladimir 2013-02-14 10:03:32
刪除scaleToSize,因爲它不支持UIImage – 2013-02-14 10:07:24
你沒有在'scaleToSize'行上得到警告嗎? – esh 2013-02-14 10:07:53