3
我搜索与UIImage相关的内存问题,并遇到许多线程谈论这个问题,但没有真正的帮助或解决方案。UIImage内存问题由于缓存
我知道我们什么时候使用-imageNamed:
对象正在被缓存,所以最好使用initWithData:
。当我们使用drawRect:
和UIGraphicsGetImageFromCurrentImageContext()
时,图像是否会缓存?
另外,在下面的代码:
CGImageRef tmp = CGImageCreateWithImageInRect(imageToCrop.CGImage, clippedRect); //pull the image from our cropped context UIImage *cropped = [UIImage imageWithCGImage:tmp];//UIGraphicsGetImageFromCurrentImageContext();
CGImageRelease(tmp);
是缓存发生,虽然没有关于这个文档中引用?我们如何释放缓存占用的内存?
我想知道关于这一点。我有一个背景UIImageView,通过点击一个按钮进行滚动,在每个按钮的位置,它使用[UIImage imageNamed:...]设置为另一个图像,并且分配的实时字节只是不断增加。如何正确处理这个问题? – GeneCode 2012-02-22 03:17:40