Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UITableViewCells不是';设置图像时不重新加载_Ios_Swift_Uitableview_Imageview - Fatal编程技术网

Ios UITableViewCells不是';设置图像时不重新加载

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

我有一个UITableView,我正在使用Haneke下载图像以显示。下载完成后,单元不会重新加载。图像仅在滚动时显示

这是我的tableView CellForRowatineXpath函数

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