【发布时间】:2014-01-03 13:47:52
【问题描述】:
我正在尝试从 url 加载图像,这些图像在模拟器中完美显示,但在 iphone 上却没有。关于可能是什么问题的任何想法? 这是代码
uiImageView = [[UIImageView alloc] initWithFrame:CGRectMake(40, iImageViewStart, 200, iImageHeight-50)];
uiImageView.contentMode = UIViewContentModeScaleAspectFit;
[self downloadImageWithURL:url completionBlock:^(BOOL succeeded, UIImage *image) {
if (succeeded) {
uiImageView.image = image;
}
}];
[scroll addSubview:uiImageView];
cellForRowAtIndexPath
`UIImageView *iconImage = [[UIImageView alloc] initWithFrame:CGRectMake(5,5, 40, 40)];`
[self downloadImageWithURL:url completionBlock:^(BOOL succeeded, UIImage *image) {
if (succeeded) {
iconImage.image = image;
tmpImage = image;
}
}];
//iconImage.image =tmpImage;
iconImage.layer.cornerRadius=20;
iconImage.backgroundColor=[UIColor blackColor];
iconImage.contentMode=UIViewContentModeScaleAspectFit;
[cell.contentView addSubview:iconImage];`
didSelectRowAtIndexPath
FinalProdDisplay *FinalProdDisplayView = [ [FinalProdDisplay alloc] initWithNibName:@"FinalProdDisplay" bundle:nil];
Product *product = [ [Product alloc] init];
product= [arrayProducts objectAtIndex:[indexPath row]];
FinalProdDisplayView.strUrl=product.strProductImageUrl;
【问题讨论】:
-
欢迎来到 SO。你试过什么?你能发布一些代码吗??
-
对不起,我的水晶球昨天坏了....严重...您需要提供一些代码,没有人会帮助您只提供这些信息
-
模拟器接受更广泛的图像格式。有时您有设备无法显示的特定文件类型。仔细检查文件格式。
-
由于我们必须根据给定的有限信息进行猜测,您确定您的设备已连接到互联网吗?
-
@SibaPrasadHota 模拟器支持什么图像格式,而设备不支持?我使用了各种各样的图像类型(颜色空间、bpc、alpha 设置等)并且从未见过模拟器可以显示的图像,但设备不能(除了与图像无关的原因,例如大写、大小、连接性等)。
标签: ios objective-c uiimage