簡體   English   中英

SDWebImage組件出現問題

[英]Issue with SDWebImage component

我使用SDWebImage組件,用於Xamarin.ios應用程序下載異步圖像。 在這里,我所面對的問題無法使用下面來自SDWebImage組件官方網站的代碼/方法。 檢查鏈接

SDWebImageManager.SharedManager.Download (
    url: new NSUrl ("http://db.tt/ayAqtbFy"), 
    options: SDWebImageOptions.CacheMemoryOnly,
    progressHandler: (recievedSize, expectedSize) => {
    // Track progress...
   },
   completedHandler: (image, error, cacheType, finished) => {
      if (image != null) {
        // do something with the image
       }
   }
  );

我遇到問題/錯誤的地方是progressHandler和completedHandler參數在那里。 這是我的實際錯誤:

錯誤CS1739:SDWebImage.SDWebImageDownloader.DownloadImage(Foundation.NSUrl,SDWebImage.SDWebImageDownloaderOptions,SDWebImage.SDWebImageDownloaderProgressHandler,SDWebImage.SDWebImageDownloaderCompletedHandler)的最佳重載方法匹配不包含名為“ progressHandler ”的參數

檢查“下載”方法后,我發現參數現在不同。 您需要通過以下方式更改代碼塊:

SDWebImageManager.SharedManager.Download (
    url: new NSUrl ("http://db.tt/ayAqtbFy"), 
    options: SDWebImageOptions.CacheMemoryOnly,
    progressBlock: (recievedSize, expectedSize) => {
        // Track progress...
    },
    completedBlock: (image, error, cacheType, finished, imageUrl) => {
        if (image != null) {
            // do something with the image
        }
    }
);

如果您注意到,“ progressHandler”和“ completedHandler”分別更改為“ progressBlock”和“ completedBlock”,並且completedBlock需要一個新參數“ imageUrl”。

暫無
暫無

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

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