I have NSOutlineView with custom cell named ListCell. I set label and icon to my custom cell. Then NSOutlineView crash on error exc_bad_access code=13. Do you have any idea, how to repair it? Thx for reply.
- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item {
return [[[DataSingleton sharedData] pages] count];
}
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item {
return NO;
}
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {
return item;
}
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item {
ListTableCellView *cell = [outlineView makeViewWithIdentifier:@"ListCell" owner:self];
cell.label.stringValue = [NSString stringWithFormat:@"%ld", index + 1];
[cell.label setBackgroundColor:[NSColor clearColor]];
if ([self.icons objectForKey:[NSString stringWithFormat:@"%ld", index]])
[[cell icon] setImage:[self.icons objectForKey:[NSString stringWithFormat:@"%ld", index]]];
return cell;
}
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item {
return YES;
}
Simply I changed NSOutlineView to NSTableView and everything is ok.