I have a custom NSOutlineView with a cell based structure.
I have hooked a custom cell for the outlineView.
For each row in the outline view, I have hooked a custom Data Model object for each Row in the outlineview.
I have hooked the node object using following methods:
(NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item(id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item(id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)theColumn byItem:(id)item
Now I need to access the data Model object in my Custom Cell Class’s drawInteriorWithFrame:: method in order to draw it accordingly.
I tried using [self objectValue] in Custom Cell Class, but it does not return me the object I passed it as ObjectValue.
Is there anything wrong in my approach? Or is there any way to fix this?
I do not know what is happening with the objectValue of the cell. But one way to handle this would be to add a property or member variable to your Cell subclass to hold a reference to your model object. Then you can use that within drawInteriorWithFrame:. Be sure to nil the reference in dealloc if you are not using ARC.