ビュー/ビューコントローラーの大規模な階層があります。
メインコントローラーには、aViewController が MyClass のメンバーである次のコードがあります。
@implementation MyClass
...
- (void) viewDidLoad
{
[self.view addSubview:aViewController_.view];
[aViewController_ setDataSource:self];
[aViewController_ setDelegate:self];
}
- (void)dealloc
{
//[aViewController_.view removeFromSuperview]; // All ok when this is added
[aViewController_ release];
[super dealloc];
}
...
@end
これを実行すると、解放されないことがわかりますaViewController
-保持カウントは最後に1のままです。
ただし、 dealloc に追加[aViewController_.view removeFromSuperview];
すると、すべて正常に動作します。
どうしてこれなの?[super dealloc]
ビューのリリースを処理する必要はありませんか? ビューがコントローラーの後に解放されていることは重要ですか?
簡単なテストアプリケーションで再現しようとしましたが、うまくいきませんでした。