Ios UITableViewCells不是';设置图像时不重新加载
我有一个UITableView,我正在使用Haneke下载图像以显示。下载完成后,单元不会重新加载。图像仅在滚动时显示 这是我的tableView CellForRowatineXpath函数Ios UITableViewCells不是';设置图像时不重新加载,ios,swift,uitableview,imageview,Ios,Swift,Uitableview,Imageview,我有一个UITableView,我正在使用Haneke下载图像以显示。下载完成后,单元不会重新加载。图像仅在滚动时显示 这是我的tableView CellForRowatineXpath函数 func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCel
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("businessCell", forIndexPath: indexPath) as! BusinessTableViewCell
let business = self.businessObjects[indexPath.row]
let photoReference = business.businessPhotoReference
googlePlacesClient.getImageFromPhotoReference(photoReference) { (key) -> Void in
self.cache.fetch(key: key).onSuccess { image in
cell.businessBackgroundImage.hnk_setImage(image, key: photoReference)
cell.businessBackgroundImage.setNeedsLayout()
}
}
return cell
}
您可能需要在某个地方重新加载表视图<代码>self.tableView.reloadData()或其他什么。不要在
cellForRow:
中这样做,因为您会多次启动它。您可能需要在主队列上调度hnk\u setImage