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