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

问题描述 投票:0回答:2

我正在尝试从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;
ios objective-c uiimage
2个回答
0
投票

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


0
投票

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

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

© www.soinside.com 2019 - 2024. All rights reserved.