Ich schreibe eine Funktion, die nur ein Menü (bestehend aus einem TableView) in einem popOver anzeigt.Ich habe fünf Zuordnungen für ein Objekt mit nur einer Zuweisung in der gleichen Funktion
Dies ist der Quellcode:
-(void)pushSearch:(NSString *)option type:(int)optionType
{
searchNav = [[iNavigation alloc] initWithNibName:@"iNavigation" bundle:nil] ;
//This is the UIViewController with the tableView
[searchNav setSearchMode:optionType];
searchNav.view.frame =CGRectMake(0,0,300,600);
NSLog(@"Retain Count: %d",[searchNav retainCount]);
// An dieser Stelle behalten Anzahl 1
if ([pop isPopoverVisible])
{
[pop dismissPopoverAnimated:YES];
[pop release];
}
pop = [[UIPopoverController alloc] initWithContentViewController:searchNav];
NSLog(@"Retain Count: %d",[searchNav retainCount]);
//At this point retain count is 2
[pop presentPopoverFromRect:btnMenu.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
[pop setPopoverContentSize:CGSizeMake(350,600)];
NSLog(@"Retain Count: %d",[searchNav retainCount]);
//At this point retain count is 5!!!
[searchNav release];
}
Das Problem, das ist das ich habe ist, dass der verwendete Speicher die Tableview zu laden ist nie veröffentlicht. Meine App wächst und wächst im Speicher bis zum Absturz.
Warum, wenn ich nur eine Zuweisung für searchNav mache, nachdem ich sie dem popOver zugewiesen habe, ist die Anzahl der Reatins 5?
Bitte irgendwelche Hilfe?
Können wir das 'retaincount]' -Tag automatisch umleiten zu '[replacecount-is-evil-stopit-stopit-stop]'? – walkytalky