2014-08-29 72 views

回答

3

我假設你正在使用這樣的圖像設置爲您的圖像視圖:

[imgV setImage:[UIImage imageNamed:@"yourImg.png"]] 

與使用的問題是,應用程序緩存這些圖像。使用它

[imgV setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"yourImg.png" ofType:nil]]]; 

此外,請務必將圖片設置爲nil當你做:如果你想避免緩存圖像,使用imageWithContentsOfFile:

[imgV setImage:nil]; 

我有問題這在過去,這裏是從電子郵件我響應了TSI蘋果回來一些文字:

有您所使用的API的UIImage + imageName,其中相當多的情況下, d:加載圖像,但您應該意識到,即使在返回的UIImage對象是 發佈後,imageNamed也會緩存其圖像數據。更換調用imageNamed與-imageWithContentsOfFile:概述如下 是一種方式,以確保在你的應用程序的 圖像數據完全控制在內存

+0

我使用[UIImage的imageWithData:] – 2014-08-29 00:40:35

+0

你要爲你的圖像視圖的'形象'當你完成這個任務時'爲'nil'?你載入的圖像有多大(像素明智)? – rebello95 2014-08-29 00:44:42

+0

啊,設置圖像爲零的竅門 – 2014-08-29 00:45:14