0
有人可以指出我在正確的方向。當我將這個文件作爲一個筆尖加載,並卸載它,並重新加載它的儀器說我得到一個內存泄漏。具體來說,它說我在哪裏設置了compareOptions NSMutableArray,以及我在哪裏調用[vc release]。 CompareOptions是一個合成屬性,它也在dealloc中發佈。 非常感謝提前。內存泄漏與陣列
- (void)viewDidLoad{
[super viewDidLoad];
//NSLog(@"Comparison.viewDidLoad");
self.compareOptions = [[NSMutableArray alloc] init];
self.tabs = [[ComparisonTabs alloc] initWithFrame:CGRectMake(450, 85, 650, 50)];
//NSDictionary * currComparison = (NSDictionary*)[data objectAtIndex:0];
//NSArray * correctOptions = [currComparison objectForKey:@"correct"];
for(int i = 0; i < 3; i++)
{
UIViewController * vc = [[UIViewController alloc] initWithNibName:@"ComparisonOptions" bundle:nil];
ComparisonOptions * options = (ComparisonOptions *)vc.view;
[options setup];
options.index = i;
//options.frame = CGRectMake(355 + (306 * i), 475, options.frame.size.width, options.frame.size.height);
//[options setCorrect:[correctOptions objectAtIndex:i]];
[vc release];
[self.view addSubview:options];
[self.compareOptions addObject:options];
}
[self.view addSubview:self.tabs];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tabSelectedHandler:) name:@"tabSelected" object:nil ];
[self update:0];}