popOver にメニュー (tableView で構成される) のみを表示する関数を作成しています。
これはソースコードです:
-(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]);
//この時点で保持カウントは 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];
}
私が抱えている問題は、テーブルビューをロードするために使用されたメモリが解放されないことです。私のアプリは、クラッシュするまでメモリ内で成長し続けます。
searchNav の割り当てを 1 つだけ行っている場合、それを popOver に割り当てた後、reatin カウントが 5 になるのはなぜですか?
助けてください。