AgentDashboardNavigationController LIVES!
Я продолжаю идти по той же процедуре, при которой VC agentDashboardNavigationController в моей вкладке BarController заменяется интерфейсом редактирования 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];