project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m
changeset 6074 047eaed35cbb
parent 5208 878e551f0b4a
child 6103 55ecfbf834e3
equal deleted inserted replaced
6073:e6ce1a337e0f 6074:047eaed35cbb
    41                                                                    style:UIBarButtonItemStyleBordered
    41                                                                    style:UIBarButtonItemStyleBordered
    42                                                                   target:self
    42                                                                   target:self
    43                                                                   action:@selector(toggleEdit:)];
    43                                                                   action:@selector(toggleEdit:)];
    44     self.navigationItem.rightBarButtonItem = editButton;
    44     self.navigationItem.rightBarButtonItem = editButton;
    45     [editButton release];
    45     [editButton release];
       
    46 
       
    47     self.navigationItem.title = @"List of teams";
    46 }
    48 }
    47 
    49 
    48 // load the list of teams in the teams directory
    50 // load the list of teams in the teams directory
    49 -(void) viewWillAppear:(BOOL)animated {
    51 -(void) viewWillAppear:(BOOL)animated {
    50     [super viewWillAppear:animated];
    52     [super viewWillAppear:animated];
   129     NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@",TEAMS_DIRECTORY(),[self.listOfTeams objectAtIndex:row]];
   131     NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@",TEAMS_DIRECTORY(),[self.listOfTeams objectAtIndex:row]];
   130     [[NSFileManager defaultManager] removeItemAtPath:teamFile error:NULL];
   132     [[NSFileManager defaultManager] removeItemAtPath:teamFile error:NULL];
   131     [teamFile release];
   133     [teamFile release];
   132 
   134 
   133     [self.listOfTeams removeObjectAtIndex:row];
   135     [self.listOfTeams removeObjectAtIndex:row];
   134     [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
   136     [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
   135 }
   137 }
   136 
   138 
   137 
   139 
   138 #pragma mark -
   140 #pragma mark -
   139 #pragma mark Table view delegate
   141 #pragma mark Table view delegate
   148     // this must be set so childController can load the correct plist
   150     // this must be set so childController can load the correct plist
   149     childController.teamName = [selectedTeamFile stringByDeletingPathExtension];
   151     childController.teamName = [selectedTeamFile stringByDeletingPathExtension];
   150     [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO];
   152     [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO];
   151 
   153 
   152     [self.navigationController pushViewController:childController animated:YES];
   154     [self.navigationController pushViewController:childController animated:YES];
       
   155     [tableView deselectRowAtIndexPath:indexPath animated:YES];
   153 }
   156 }
   154 
   157 
   155 
   158 
   156 #pragma mark -
   159 #pragma mark -
   157 #pragma mark Memory management
   160 #pragma mark Memory management