0
AgentDashboardNavigationController LIVES!找不到遗弃的记忆
我一直在通过相同的过程,通过编辑界面VC替换tabBarController中的agentDashboardNavigationController VC。
完成后,编辑界面被替换为新的agentDashboardNavigationController。
由于某种原因,活动agentDashboardNavigationController对象的数量不断增加。
基本上,我通过替换视图控制器的可变副本中的对象,来回翻看那一个选项卡中生活的内容。
agentDashboardNavigationController在交换:
NSMutableArray *newViewControllers = [self.mainTabBarController.viewControllers mutableCopy];
AgentDashboardNavigationController *agentDashboardNavigationController = [[AgentDashboardNavigationController alloc] init];
// cycle through until we find the agentcontroller and remove it
// for now that's the only controller that gets removed so we break
NSUInteger index = [newViewControllers indexOfObjectPassingTest:^BOOL (id obj, NSUInteger idx, BOOL *stop) {
return [[obj tabBarItem].title isEqualToString:@"Guest Card"];
}];
[newViewControllers replaceObjectAtIndex:index withObject:agentDashboardNavigationController];
[self.mainTabBarController setViewControllers:newViewControllers animated:NO];
[newViewControllers release];
[agentDashboardNavigationController release];
其换出:
UISplitViewController *splitVC = self.guestCardManagementController.splitViewController;
// remove agentTab
NSMutableArray *newViewControllers = [self.mainTabBarController.viewControllers mutableCopy];
// cycle through until we find the agentcontroller and remove it
NSUInteger index = [newViewControllers indexOfObjectPassingTest:^BOOL (id obj, NSUInteger idx, BOOL *stop) {
return [obj class] == [AgentDashboardNavigationController class];
}];
[newViewControllers replaceObjectAtIndex:index withObject:splitVC];
[self.mainTabBarController setViewControllers:newViewControllers animated:NO];
[newViewControllers release];