UITabBarController's
viewControllers
是navigationController
,当我发布tabbarcontroller
时,我发现内存不会被释放?
答案 0 :(得分:0)
如果在.xib文件中创建它们,则无法释放它们。 他们将在你的申请结束后被释放!!!
答案 1 :(得分:0)
- (void)dealloc {
[tabbarcontroller release];
[window release];
[super dealloc];
}
答案 2 :(得分:0)
如果你正在使用代码,你可能需要在将它们添加到tabBarController后释放navigationControllers ...
tabBarController = [[UITabBarController alloc] init];
NSMutableArray *controllerArray = [[NSMutableArray alloc] initWithCapacity:2];
UINavigationController *localNavigationController;
AccountViewController *accountViewController = [[AccountViewController alloc] init];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:accountViewController];
[controllerArray addObject:localNavigationController];
[localNavigationController release];
[accountViewController release];
AccountHistoryViewController *accountHistoryViewController = [[AccountHistoryViewController alloc] init];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:accountHistoryViewController];
[controllerArray addObject:localNavigationController];
[localNavigationController release];
[accountHistoryViewController release];
[tabBarController setViewControllers:controllerArray];
[controllerArray release];