Re: NSTableView Sends Null Column to Delegate/DataSource
Re: NSTableView Sends Null Column to Delegate/DataSource
- Subject: Re: NSTableView Sends Null Column to Delegate/DataSource
- From: Keary Suska <email@hidden>
- Date: Sat, 14 Jul 2012 11:08:49 -0600
On Jul 13, 2012, at 10:44 PM, John Terranova wrote:
> A nil tableColumn means to treat the whole row as one wide column, rather than the individual columns. It is useful for section headers. The docs for the applicable methods should explain the nil tableColumn.
Thanks for the suggestion--although I knew this fact it did get me to re-read the docs more carefully and to experiment more, and I found the solution.
I was experimenting with implementing group rows in a vanilla NSTableView, but when things were going awry I commented out tableView:isGroupRow:, thinking that this would eliminate group row handling, but no, it does not!
For the archives, it is not safe to assume that tableView:isGroupRow: will determine which rows are actually group rows, at least if you implement tableView:dataCellForTableColumn:row:. It seems that regardless of whether you implement tableView:isGroupRow:, NSTableView will always send tableView:dataCellForTableColumn:row: a nil tablecolumn argument to determine whether the row is a group row (ostensibly). If you return an NSCell object, it will assume that the row is a group row and as a consequence will assume that *every* row is a group row unless the row returns nil.
The solution was to both check for a nil tablecolumn value in tableView:dataCellForTableColumn:row *and* call my own implementation of tableView:isGroupRow: to make sure that the row is in fact a designated group row.
> On Jul 13, 2012, at 11:21 PM, Keary Suska <email@hidden> wrote:
>
>> I am having a strange issue I haven't encountered before--for all of my data source and delegate methods the table view is sending nil for the table column, which obviously prevents me from fulfilling any of the requests. Has anyone seen this?
>>
>> Xcode 4, targeting 10.6.
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden