I am trying to disable a particular cell in a particular table. I want to be able to do all of this for a whole column in the near future but for now I am trying things out.
tc1 and tc2 represent NSTableColumns whilst tv represents the NSTableView.
The code compiles and run however, the cell at row 2 and table column named "column1" is still enabled. What do I need to do to make it disabled?
Code sample below:
-(id)init
{
self = [super init];
if (self)
{
arr = [[NSMutableArray alloc] init];
[tc1 setIdentifier:@"colum1"];
[tc2 setIdentifier:@"colum2"];
[tv setDelegate:self];
}
return (self);
}
- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
if([[aTableColumn identifier] isEqualToString:@"column1"])
{
if (rowIndex == 2) // myindex holds the row index where I need to disable the cells
{
[aCell setEnabled:NO];
}
}
else
{
[aCell setEnabled:YES];
}
}
Problem was spelling mistake when declaring the identifier. Solved.