project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m
branchios-revival
changeset 11217 e68b3e392091
parent 10108 c68cf030eded
child 11229 b49dfdf628f6
--- a/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m	Mon Oct 19 03:39:47 2015 +0200
@@ -136,43 +136,43 @@
 
 #pragma mark -
 #pragma mark Table view delegate
--(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-    if (childController == nil) {
-        childController = [[SingleTeamViewController alloc] initWithStyle:UITableViewStyleGrouped];
-    }
-
+-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    SingleTeamViewController *singleTeamViewController = [[SingleTeamViewController alloc] initWithStyle:UITableViewStyleGrouped];
+    
     NSInteger row = [indexPath row];
     NSString *selectedTeamFile = [listOfTeams objectAtIndex:row];
 
     // this must be set so childController can load the correct plist
-    childController.teamName = [selectedTeamFile stringByDeletingPathExtension];
-    [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO];
+    singleTeamViewController.teamName = [selectedTeamFile stringByDeletingPathExtension];
+    [singleTeamViewController.tableView setContentOffset:CGPointMake(0,0) animated:NO];
 
-    [self.navigationController pushViewController:childController animated:YES];
+    [self.navigationController pushViewController:singleTeamViewController animated:YES];
+    [singleTeamViewController release];
+    
     [tableView deselectRowAtIndexPath:indexPath animated:YES];
 }
 
 
 #pragma mark -
 #pragma mark Memory management
--(void) didReceiveMemoryWarning {
+-(void) didReceiveMemoryWarning
+{
     // Releases the view if it doesn't have a superview.
     [super didReceiveMemoryWarning];
     // Relinquish ownership any cached data, images, etc that aren't in use.
-    if (childController.view.superview == nil )
-        childController = nil;
 }
 
--(void) viewDidUnload {
+-(void) viewDidUnload
+{
     self.listOfTeams = nil;
-    childController = nil;
     MSG_DIDUNLOAD();
     [super viewDidUnload];
 }
 
--(void) dealloc {
+-(void) dealloc
+{
     releaseAndNil(listOfTeams);
-    releaseAndNil(childController);
     [super dealloc];
 }