我试图缓存(Haneke)图像并显示它,但我似乎无法找出hnk_setImage
中的第一个UIImage参数。如何从logoCache
键显示图像?
缓存图片
cache.set(value: logoData, key: logoCache)
获取并显示图片
cell.customerImageView?.hnk_setImage(UIImage?, key: logoCache)
答案 0 :(得分:0)
var mArray = [[String:AnyObject]]()
在cellForItemAtIndexPath
函数内
var var1 = mArray[indexPath.row]
let ImageURLKey = var1["logoCache"] as! String
if let url = NSURL(string: "yourUrl/"+ImageURLKey) {
cell.imageView.contentMode = UIViewContentMode.ScaleAspectFit
cell.imageView.hnk_setImageFromURL(url)
}