我在我的UITableView
中做了一些load on scroll
以从服务器获取数据。如何使[滚动加载]不继续添加图像到内存中?
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath)
{
let lastElement = self._titles_en.count - 1
if indexPath.row == lastElement
{
page += 1
searchForString()
}
}
每个条目添加一个UITableViewCell与加载UIImageView
使用kingfisher
loadRemoteImage(placeImage, argURL: _images[indexPath.row], cr : 0)
现在的问题是,我如何确保所使用的RAM不会继续增加?
我在调试工具中观察内存,它增加了10兆字节大约3页的负载,这是太多了,它开始超过200兆字节,所以有什么技巧可以避免这种内存开放增加?我害怕用户多次滚动并出现繁荣,应用程序崩溃。
有你异型看到,如果你是刚刚泄露的图像,或者如果他们是住缓冲? –
好问题@GradyPlayer,你能告诉我如何确定吗? – DeyaEldeen
在这种方法写这行代码:'loadRemoteImage(placeImage,argURL:_images [indexPath.row],cr:0) ' –