On 25 Jun 2014, at 16:41, Ken Thomases <k...@codeweavers.com> wrote:
> 
> Couldn't you return a custom row view using -tableView:rowViewForRow: and 
> then return no cell views for that row by returning nil from 
> -tableView:viewForTableColumn:row:?
> 
Customising the group row behaviour does seem like the answer here.
The required groupRow view can be defined by calling

 - (void)registerNib:(NSNib *)nib forIdentifier:(NSString *)identifier

Then, when

 - (NSView *)tableView:(NSTableView *)tableView 
viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row 

is called it is just a matter of retrieving the group row nib using

- (id)makeViewWithIdentifier:(NSString *)identifier owner:(id)owner

The group row styling will be applied though, which I don’t require.
Rather than having to define a custom NSTableRowView it seems sufficient to 
just reset the groupRowStyle on the row view.

- (void)tableView:(NSTableView *)tableView didAddRowView:(NSTableRowView 
*)rowView forRow:(NSInteger)row
{
    // if a group row has been added then turn off the group styling
    // so that group rows are drawn like other rows
    if ([self tableView:tableView isGroupRow:row]) {
        rowView.groupRowStyle = NO;
    }
}

The cell views do get recycled so it is often necessary, especially when 
binding to different object types in the one tableview to normalise the 
NSTableCellView.

    NSTableCellView *cellView = [tableView makeViewWithIdentifier:identifier 
owner:nil];
    
    // the cell view may be recycled so normalise it
    cellView.objectValue = nil;
    [cellView.textField unbind:NSValueBinding];
    cellView.textField.stringValue = @""; 

Thanks

Jonathan
> Regards,
> Ken
> 


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to