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