Accessory view in UITableView: view doesn't update

Posted by Kamchatka on Stack Overflow See other posts from Stack Overflow or by Kamchatka
Published on 2010-05-22T02:13:13Z Indexed on 2010/05/22 2:20 UTC
Read the original article Hit count: 321

I'm trying to add checkmarks to items when the user select rows in a table view. However, the view is not refreshed and the checkmarks do no show up:

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

    UITableViewCell* oldCell = [self tableView:tv cellForRowAtIndexPath:[NSIndexPath indexPathForRow:selectedIndex inSection:0]];
    oldCell.accessoryType = UITableViewCellAccessoryNone;

    if (indexPath.section == 0) {
        selectedIndex = indexPath.row;
    }

    UITableViewCell* newCell = [self tableView:tv cellForRowAtIndexPath:indexPath];
    newCell.accessoryType = UITableViewCellAccessoryCheckmark;

    [tv deselectRowAtIndexPath:indexPath animated:NO];
}

What could be a reason for that?

© Stack Overflow or respective owner

Related posts about uitableview

Related posts about iphone-sdk