次のコードを書きました。
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
GameViewController *gameViewController = [[GameViewController alloc]initWithLevelNumber:([levelGroup intValue]*100+indexPath.row) Bonus:NO];
NSLog(@"Retain Counter =%d",gameViewController.retainCount);
[navController pushViewController:gameViewController animated:YES];
[gameViewController release];
NSLog(@"Retain Counter=%d",gameViewController.retainCount);
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
2 つのログの結果は、順番に1と6です。これはどのように可能ですか?alloc メソッドを 1 回だけ呼び出し、コントローラーをスタックにプッシュした後に解放します。alloc-> +1、push-> +1、release-> -1 = 1 かどうか?
スタックからポップするときに、View Controller の割り当てを解除したいのですが..