开发者

Image caching in iOS

If I do

rowBackground = [[UIImageView alloc]initWithImage:[UIImage imageName开发者_Go百科d:@"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?

Thanks in advance!


As the reference of +imageNamed::

This method looks in the system caches for an image object with the specified name and returns that object if it exists. If a matching image object is not already in the cache, this method loads the image data from the specified file, caches it, and then returns the resulting object.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜