project_files/HedgewarsMobile/Classes/SavedGamesViewController.m
branchios-revival
changeset 11250 7f3f96e9fdf1
parent 11116 102684240fe8
child 11253 62d1a66b353d
equal deleted inserted replaced
11247:5c21ee975d5d 11250:7f3f96e9fdf1
   125     EditableCellView *editableCell = (EditableCellView *)[aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
   125     EditableCellView *editableCell = (EditableCellView *)[aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
   126     if (editableCell == nil) {
   126     if (editableCell == nil) {
   127         editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
   127         editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
   128         editableCell.delegate = self;
   128         editableCell.delegate = self;
   129     }
   129     }
       
   130     editableCell.tag = [indexPath row];
   130     editableCell.respectEditing = YES;
   131     editableCell.respectEditing = YES;
   131     editableCell.textField.text = [[self.listOfSavegames objectAtIndex:[indexPath row]] stringByDeletingPathExtension];
   132     editableCell.textField.text = [[self.listOfSavegames objectAtIndex:[indexPath row]] stringByDeletingPathExtension];
   132     editableCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
   133     editableCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
   133 
   134 
   134     return (UITableViewCell *)editableCell;
   135     return (UITableViewCell *)editableCell;
   155 -(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
   156 -(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
   156     return 60;
   157     return 60;
   157 }
   158 }
   158 
   159 
   159 -(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
   160 -(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
   160     [(EditableCellView *)[self.tableView cellForRowAtIndexPath:indexPath] save:nil];
   161     [((EditableCellView *)[self.tableView cellForRowAtIndexPath:indexPath]).textField resignFirstResponder];
       
   162     
   161     self.numberOfItems--;
   163     self.numberOfItems--;
   162     [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];
   164     [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];
   163 
   165 
   164     NSString *saveName = [self.listOfSavegames objectAtIndex:[indexPath row]];
   166     NSString *saveName = [self.listOfSavegames objectAtIndex:[indexPath row]];
   165     NSString *filePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),saveName];
   167     NSString *filePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),saveName];