簡體   English   中英

找不到廢棄的內存

[英]Can't find abandoned memory

AgentDashboardNavigationController生活!

我將繼續執行相同的過程,從而將tabBarController中的agentDashboardNavigationController VC替換為編輯界面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];

從頭開始。 問題是保留周期。 一旦意識到要在“記錄引用計數”位上打勾,我可以看到它的孩子正在保留它!

我的第一個。 那些人是很難解決的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM