本文介绍了iOS中的图像缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我这样做
rowBackground = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"bottomCell2.png"]
在应用程序的整个生命周期中缓存图像还是在我每次执行该指令时(在其他视图或应用程序的一部分中)重新加载并重新缓存图像?
the image is cached for the entire life cycle of the app or reloaded and recached everytime I execute that instruction (in other views or part of the app)?
我在应用程序的每个表视图中执行此操作.有效率吗?
I do that in every tableview of my app. Is it efficient?
提前谢谢!
推荐答案
作为+imageNamed:
的引用:
缓存是有效的,但会占用内存.如果您的表格视图包含大量图像,则内存可能会耗尽.因此,您可以考虑+imageWithContentsOfFile:
或其他类似方法来加载图像.
Cache is efficient, but eats memory. If your table view contains large amount of images, the memory may burn up. So you may consider +imageWithContentsOfFile:
or other similar methods to load image.
这篇关于iOS中的图像缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!