On Jul 12, 2014, at 9:20 AM, Navneet Kumar wrote:

> I had one (set cell-based in IB) outline view in my project using custom cell 
> for one table Column (identifier : “Description”).
> And it was working fine with my AppDelegate implementing the required 
> datasource and some delegate methods.
> 
> I added another (set view-based in IB) outline view and I am returning custom 
> views in the following method (in AppDelegate):
> 
> - (NSView *)outlineView:(NSOutlineView *)outlineView 
> viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
>       NSString *identifier = [tableColumn identifier];
>       if ([outlineView isEqualTo:outlineViewThumbs]) {
>               if ([identifier isEqualToString:COLUMN_ID_DESC]) {// having 
> only one table column
>               return [item cellView];
>               }
>       }
>       return nil;
> }
> 
> This view-based outline view is working as expected, but the earlier 
> cell-based outline is now showing empty rows (yes, it does populate as is 
> evident from the vertical scroller and clicking also selects the row).
> Adding a breakpoint in the above method, I can see it being called by 
> cell-based outline view, and in this case this method returns nil. And the 
> outlineView: objectValueForTableColumn: item: method doesn’t get called.
> If I comment the last line in above method and return nothing for the 
> cell-based outline view, the outlineView: objectValueForTableColumn: item: is 
> called after the above method, but it leads to crash at another place in code 
> where I’m doing [tabView display];. This tabView contains both the outline 
> views in separate tabs.
> 
> How to tackle it?
> Do I need to use two separate classes for datasource and delegate for the two 
> outline views?

Most likely. As far as I can tell, there is no public property that tells an 
NSTableView whether it is cell-based or view-based, so I am not surprised that 
it determines this based on implemented delegate methods. Alternatively, since 
cell-based table views are being deprecated, you could convert your cell-based 
to view-based and then your app will have some future-proofing.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to