簡體   English   中英

UIImageView在本地化的iOS應用程序之后不顯示下載的圖像

[英]UIImageView not show downloaded images after localized iOS app

當我本地化iOS應用程序。 UIImageView根本沒有顯示圖像,這些圖像是我從網址下載的。 注意:我正在使用AsyncImageView組件。

@implementation CategoryView

+ (CategoryView *)getViewWithTitle:(NSString *)title andImageUrl:(NSString *)imgUrl {

    CategoryView *view = [[[NSBundle getBundle] loadNibNamed:@"CategoryView" owner:self options:nil] objectAtIndex:0];


    [view configureWithTitle:title andImageUrl:imgUrl];

    return view;
}

- (void)configureWithTitle:(NSString *)title andImageUrl:(NSString *)imgUrl {


    [self bringSubviewToFront:_viewBtn];

    self.imageView.layer.cornerRadius = self.imageView.frame.size.width / 2;
    self.imageView.clipsToBounds = YES;

    self.categoryTitleLabel.text = title;
    [self.imageView setImageURL:[NSURL URLWithString:imgUrl]];
}

據我所知,你想訪問從url下載的那些圖像,一旦它完成下載就會顯示它是不是?

如果是這樣,那么我想告訴你,AsyncImageView只是異步地將圖像下載到緩存中,但它不會長時間將圖像存儲到磁盤中,因此你無法在離線模式下將圖像看到imageView,

為此,您需要將所有下載的圖像保存到緩存中,並需要從中獲取圖像,

您可以使用FastImageCache

您可以嘗試SDWebImage庫,它提供了一個支持緩存的異步圖像下載程序。

文檔中列出的一些功能:

UIImageView,UIButton,MKAnnotationView的類別添加Web圖像和緩存管理

異步圖像下載器

具有自動緩存到期處理的異步內存+磁盤映像緩存

背景圖像解壓縮

保證不會多次下載相同的URL

保證不會一次又一次地重試偽造的URL

保證主線程永遠不會被阻止

表演!

使用GCD和ARC

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM