避免UIImage的imageNamed - 内存管理 [英] Avoid UIImage’s imageNamed - memory management

查看:233
本文介绍了避免UIImage的imageNamed - 内存管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过 链接,我遇到了避免UIImage的imageNamed 。为什么我们应该避免这个?

I was going through this link, where I came across a point Avoid UIImage’s imageNamed. For what reason we should avoid this?

感谢,

Nitish

Thanks,
Nitish

推荐答案

在苹果WWDC视频部分,他们说的imageNamed泄漏一次...但不再做...我记得看到的视频,但不记得哪个视频部分。它是在2010年WWDC我认为..ImageNamed仍然缓存图像...从文档of imageNamed ..

In Apple WWDC videos section they are saying imageNamed leaked once..But no longer do..I remember seeing the video, but cant remember which video section..It was in 2010 WWDC I think..ImageNamed still caches images..From documentation of imageNamed..


此方法在系统缓存中查找带有
指定名称的图像对象,并返回该对象if它存在。如果匹配的
图像对象尚未在高速缓存中,则此方法从指定文件加载图像
数据,将其缓存,然后返回
生成的对象。

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.

但是我认为当任何低内存条件发生时这些缓存将被清除。为了您的信息...我是一个狂热的imageNamed和我总是使用它..我从来没有任何内存问题与它..

But I think these cache's will be cleared when any low memory condition occurs..Just for your information..I am an avid fan of imageNamed and I always use it..I never had any memory issues with it..

这篇关于避免UIImage的imageNamed - 内存管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆