【发布时间】:2017-02-19 02:38:43
【问题描述】:
我正在从缩略图中检索图片,但图片太大,所以当放在桌子上时,加载所有内容都需要很长时间。有没有人有关于如何将图像调整为大约 50 * 50 以便 tableView 加载更快的建议? Swift3 代码示例将不胜感激,因为我是编码新手。
databaseRef.child(text).child("profit").observe(.value, with: { (snapshot) in
if snapshot.value is NSNull{
}else{
let equal = snapshot.value
/*friendsCell.profilePicture.loadImageUsingCacheWithUrlString(urlString: databaseProfilePic as! String )*/
self.imageLoader.startAnimating()
!
let data = NSData(contentsOf: NSURL(string: wow as! String)! as URL)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
profit.sd_setImage(with: NSURL(string: profit as! String)! as URL, placeholderImage: UIImage(data: data! as Data))
self.imageLoader.stopAnimating()
}
}
})
【问题讨论】:
-
我们可能需要更多信息。您是否在 Firebase 中存储全尺寸图像,下载它们以填充您的 tableView 数据源,然后想要调整它们的大小以便 tableView 显示得更快?
-
不要破坏你的问题。