project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m
changeset 4287 7dbdc862097c
parent 4281 e033cf015b2c
child 4976 088d40d8aba2
--- a/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m	Fri Nov 12 23:59:40 2010 +0100
+++ b/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m	Sat Nov 13 01:24:39 2010 +0100
@@ -85,12 +85,14 @@
     createTeamNamed([fileName stringByDeletingPathExtension]);
 
     [self.listOfTeams addObject:fileName];
-    [fileName release];
 
     // order the array alphabetically, so teams will keep their position
     [self.listOfTeams sortUsingSelector:@selector(compare:)];
+    [self.tableView reloadData];
 
-    [self.tableView reloadData];
+    NSInteger index = [self.listOfTeams indexOfObject:fileName];
+    [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0] atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
+    [fileName release];
 }
 
 #pragma mark -