project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m
changeset 4287 7dbdc862097c
parent 4281 e033cf015b2c
child 4976 088d40d8aba2
equal deleted inserted replaced
4284:57a501a69e5f 4287:7dbdc862097c
    80     NSString *fileName = [[NSString alloc] initWithFormat:@"Weapon %u.plist", [self.listOfWeapons count]];
    80     NSString *fileName = [[NSString alloc] initWithFormat:@"Weapon %u.plist", [self.listOfWeapons count]];
    81 
    81 
    82     createWeaponNamed([fileName stringByDeletingPathExtension], 0);
    82     createWeaponNamed([fileName stringByDeletingPathExtension], 0);
    83 
    83 
    84     [self.listOfWeapons addObject:fileName];
    84     [self.listOfWeapons addObject:fileName];
    85     [fileName release];
       
    86 
    85 
    87     // order the array alphabetically, so schemes will keep their position
    86     // order the array alphabetically, so schemes will keep their position
    88     [self.listOfWeapons sortUsingSelector:@selector(compare:)];
    87     [self.listOfWeapons sortUsingSelector:@selector(compare:)];
       
    88     [self.tableView reloadData];
    89 
    89 
    90     [self.tableView reloadData];
    90     NSInteger index = [self.listOfWeapons indexOfObject:fileName];
       
    91     [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0] atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
       
    92     [fileName release];
    91 }
    93 }
    92 
    94 
    93 #pragma mark -
    95 #pragma mark -
    94 #pragma mark Table view data source
    96 #pragma mark Table view data source
    95 -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    97 -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {