20 Feb 2011, 12:29
D_2_pragsmall

durul (2 posts)

hi bil, I have taken double error message on my kod. I update ios3.

How can I update this row.

[self removeIngredient:[[tv cellForRowAtIndexPath:indexPath] text]]; ?
    cell.hidesAccessoryWhenEditing = NO;  ?
  • (void)tableView:(UITableView *)tv commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if(editingStyle == UITableViewCellEditingStyleDelete && indexPath.row < [self.ingredients count]) { [self removeIngredient:[[tv cellForRowAtIndexPath:indexPath] text]]; [tv deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft]; } }

  • (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tv dequeueReusableCellWithIdentifier:@”ingredientsCell”]; if(nil == cell) { cell = [[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:nil]; } if(indexPath.row < self.ingredients.count) { cell.textLabel.text = [self.ingredients objectAtIndex:indexPath.row]; } else { cell.textLabel.text = @”Add new ingredient”; cell.textLabel.textColor = [UIColor lightGrayColor]; cell.hidesAccessoryWhenEditing = NO; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; } return cell; }

  You must be logged in to comment