views:

50

answers:

1

Is there a way to disable accessory indicators from rows individually? I have a table that uses

- (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath
    {
        return UITableViewCellAccessoryDetailDisclosureButton;
    }

I need to disable it (remove icon and not trigger a detail disclosure event) for a single row. I thought this would do it, but has no result. The indicator still appears and it still receives and event on touch.

cell.accessoryType = UITableViewCellAccessoryNone;

Thanks for any suggestions.

+1  A: 

That function call 'accessoryTypeForRow..' is depeecated now (from sdk 3.0 +).

Preferred way of setting the accessory type is in 'cellForRowAt..' method

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"SomeCell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
    }

    // customize the cell
     cell.textLabel.text = @"Booyah";
    // sample condition : disable accessory for first row only...
     if (indexPath.row == 0)
         cell.accessoryType = UITableViewCellAccessoryNone;

     return cell;
}
sujee
Thank you. That put me on the write track.
DenVog