图像显示在模拟器中但不在设备中

时间:2014-01-03 13:47:53

标签: ios objective-c uiimage

我正在尝试从网址加载图片,这些图片在模拟器中完美显示,但在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;

2 个答案:

答案 0 :(得分:0)

请检查您的图片名称。 iOS模拟器不区分大小写,而设备大小写。 因此,请仔细检查图像文件名。

答案 1 :(得分:0)

我检查了以http:// ...开头的服务器URL。

我用https替换了http,iOS应用中的图像开始显示。

相关问题