1

if i use this code it's ok i can add 1 checkmark in only 1 row but in 2 sections but i need to add 1 checkmark in each section.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{

    int newRow = [indexPath row];
    int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; 

    if(newRow != oldRow)
    {
        UITableViewCell* newCell = [tableView cellForRowAtIndexPath:indexPath];
        newCell.accessoryType = UITableViewCellAccessoryCheckmark;

         UITableViewCell* oldCell = [tableView cellForRowAtIndexPath:lastIndexPath];
        oldCell.accessoryType = UITableViewCellAccessoryNone;
        lastIndexPath = indexPath;
    }
    [tableView deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:YES];
}

if i use this

if (indexPath.section == 0);

for each section it's dont work.

thank for reading

XcodeMania
  • 305
  • 5
  • 20

0 Answers0