ユーザーがボタンをクリックすると、2 つのビュー コントローラーを持つ新しいタブ バー ビュー コントローラーが表示されます。これが私がそれを行う方法です
ACLevelDownloadController *dvc = [[ACLevelDownloadController alloc] initWithNibName:@"ACLevelDownloadController" bundle:[NSBundle mainBundle]];
ACInstalledLevelsController *ivc = [[ACInstalledLevelsController alloc] initWithNibName:@"ACInstalledLevelsController" bundle:[NSBundle mainBundle]];
UITabBarController *control = [[UITabBarController alloc] init];
control.viewControllers = @[dvc, ivc];
dvc.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFeatured tag:0];
ivc.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemDownloads tag:1];
[self presentViewController:control animated:YES completion:nil];
これはうまくいきます。dismiss
との両方でメソッドをACLevelDownloadController
使用して、そのビュー コントローラーを閉じACInstalledLevelsController
ます。それもうまくいきます。奇妙なのは、View Controller を提示するとメモリ使用量が増えることです
しかし、元に戻ることはありません。再度提示するとさらに上がる
ARCを使用しています。ビュー コントローラが使用するメモリが、閉じられた後に解放されないのはなぜですか?
編集
それらが却下される方法は両方ACLevelDownloadController
であり、ACInstalledLevelsController
クリックされたときにこのメソッドを呼び出す IBActions が接続されています
- (void)dismiss:(id)sender{
[self dismissViewControllerAnimated:YES completion:nil];
}