を使用して、ビューコントローラーにかなり大きな画像をたくさんロードしています
NSUInteger nimages = 0;
for (; ; nimages++) {
NSString *nameOfImage_ = @"someName";
NSString *imageName = [NSString stringWithFormat:@"%@%d.jpg", nameOfImage_, (nimages + 1)];
image = [UIImage imageNamed:imageName];
if (image == nil) {
break;
}
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
//some other stuff....
[imageView release];
}
通常のアンロードは - (void)viewDidUnload と - (void)dealloc with self.image = nil; で行われます。[イメージリリース];
数回の「ロード」と「アンロード」の後、キャッシュはまだ元に戻せないほど大きくなっているようです!! :)
そしてアプリが落ちる…
何か案は???キャッシュを空にする方法 そしてどこに?
ありがとう
編集:
これは私が間違っていたことです。どうやら、このコードはキャッシュの問題全体を修正します。
image = [[UIImage imageNamed:imageName] autorelease];
ここでは自動解放が鍵です。
返信ありがとうございます...