I might be asking very simple question, but i am not able to get how to get rid of this, the requirement is,
- Table should display image and some text next to that. To do that, i have added two columns in the table
- NSTableView should be transparent. To do that, i have made a CustomNSTableView class, inside override drawRect method for not to draw background, and tell cell not to drawBackground.
- Now the next hurdle is how to display an image, i had to override/handled following method
.
- (NSCell *)tableView:(NSTableView *)tableView dataCellForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row{
NSImage *pCellImage = // Get a valid Image ;
if(tableColumn == nil ) return nil;
NSString *colName = [tableColumn identifier];
if([colName isEqualToString:@"firstColumn"]){
NSCell *pCell = [[NSCell alloc]initImageCell:pCellImage];
return pCell;
}else{
NSCell *pCell = [[NSCell alloc]initTextCell:@"Some text"];
return pCell;
}
}
i added tableColumn == nil condition, as in the documentation its given, first time for each row , this will be called with tableCOlumn nil when i need to set a single column for entire row, but if i return its crashing with the comment BAD_ACCESS,
Now my question is how to handle nil condition, Also in this function after setting NSCell for both Column it goes to another delegate function
- (id) tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
I believe, after setting dataSet properly i don't need to use this function,
With the following implementation its crashing, but i am not able to figure it out, what is wrong ,
i am setting proper dataSource and delegate,