我有以下代碼來顯示品牌上的圖像,但我得到一個UIImageView錯誤。 我調整了尺寸爲800x600的圖像大小以適合iPhone屏幕的大小。UIImageView _isResizable:無法識別選擇器
NSURL * url = [NSURL URLWithString:@"http://www.portallzc.com/galerias/galeria_Portal%20de%20Lazaro%20Cardenas/Club%2033/800/p16jklq9uj1f7a1c6tckkjrg1i8015.JPG"];
NSData * urlData = [NSData dataWithContentsOfURL: url];
UIImage * image = [UIImage imageWithData: urlData];
CGRect rect = CGRectMake (0.0f, 40.0f, image.size.width, image.size.height);
image = [[UIImageView alloc] initWithFrame: rect];
[setImage image: image];
Error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [UIImageView _isResizable]: unrecognized selector instance stmt to 0x6b8bb70'
什麼是[setImage image:image]; ?你的對象叫做setImage?很不好的名字 – ins0m
對不起: image = [[UIImageView alloc] initWithFrame:rect]; [image setImage image:image]; – MovileMX
爲什麼將imageView的圖像設置爲等於imageView本身? – CodaFi