【发布时间】:2017-09-23 00:07:01
【问题描述】:
我从Core Data 获得NSData,当我从NSData 转换为UIImage 时,它使我的UITableView 滚动非常缓慢。在将图像存储到Core Data 之前,我已经调整了图像的大小。有没有好的方法来做到这一点。一开始想用Kingfisher,但是好像没有这种方法可以实现。
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cellIdentifier = "ListTableViewCell"
guard let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as? ListTableViewCell else {
fatalError("The dequeued cell is not an instance of MealTableViewCell.")
}
//cell.imageContentPhoto.kf.setImage(with: url)
cell.imageContentPhoto.image = UIImage(data: photos[indexPath.row] as Data)//photo is NSData, I got it from Core Data
return cell
}
【问题讨论】:
标签: ios swift uitableview uiimage