在我的程序中,我经常需要手动设置目标视图控制器,以便我可以用数据填充它。这样可以正常工作,但是当我在源控制器和目标控制器之间来回查看Profiler时,我的分配正在飙升。我正在使用ARC。我知道这也可能是我在那个目的地设置的东西,但我也想知道 - 在回到源控制器时我不必摆脱我设置的目标控制器吗?
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
//Pull which topic the user clicked on from the table view
NSIndexPath *myIndexPath = [self.myTableView2
indexPathForSelectedRow];
NSArray * topicArray = [[myTopicLoader arrayOfFinishedCategories] objectAtIndex:myIndexPath.section];
//Create a temporary NSObject Topic to send to the detail view controller
//Set it to the Topic in the array based on which row the user clicked on
//(The tableview was populated with the same array)
topic *tempTopic = [topicArray objectAtIndex:myIndexPath.row];
//If they clicked on one that has details to show and is purchased, load the detail view controller
if ([segue.identifier isEqualToString:@"showTopicDetails"]) {
//Set up a destination view controller
topicDetailController *topicDetailController = [segue destinationViewController];
//Set its topic to the temporary one we set up here
topicDetailController.currentTopic = tempTopic;
}else {
//If they clicked on one that does not have details because it is not yet purchased, load
//the purchase view controller instead
purchaseDetailController *purchaseDetailController = [segue destinationViewController];
//And set its topic to the temporary one we set up here.
purchaseDetailController.currentTopic = tempTopic;
}
}
我的大部分超额分配都是:
29717 0xaa8a600 __NSArrayM 00:28.703.069•32 UIKit _UITapRecognizerCommonInit
或
1069 0x15d5e650 Malloc 32字节00:29.254.799•32 libsystem_sim_blocks.dylib _Block_copy_internal
我猜这可能来自我正在使用的一些预先构建的东西(书籍控制器和谷歌的XML解析器)。但我想检查一下,看看是否可能没有摆脱目标控制器与它有关。