[英]Issue Using SDWebImage in Swift
我試圖在swift中使用SDWebImage,喜歡使用的文件id叫做UIImageView + WebCache.h
我把它添加到我的橋接頭使用
#import "UIImageView+WebCache.h"
現在我正在嘗試使用swift加載該文件:
var webCah = UIImageView+WebCache()
我收到一條錯誤信息:
使用未解析的標識符'WebCache'
我相信它認為我正在嘗試使用uiimageview,當我只是想使用那個objective-c類時
我如何正確地打電話給那個班級?
UIImageView+WebCache
是使用SDWebImage特定方法擴展UIImageView
功能的類別。 您需要在UIImageView
對象上訪問其中定義的方法。
示例代碼:
var imageView :UIImageView = UIImageView() // example, this will probably come from elsewhere in your app
imageView.sd_imageURL
// Or
imageView.sd_cancelCurrentImageLoad
查看文檔以查看可用的方法,或源代碼https://github.com/rs/SDWebImage/blob/master/SDWebImage/UIImageView%2BWebCache.h
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.