• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTableView view based full width view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView view based full width view


  • Subject: Re: NSTableView view based full width view
  • From: Jonathan Mitchell <email@hidden>
  • Date: Thu, 26 Jun 2014 13:16:46 +0100

On 25 Jun 2014, at 16:41, Ken Thomases <email@hidden> 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 (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


  • Follow-Ups:
    • Re: NSTableView view based full width view
      • From: Jonathan Mitchell <email@hidden>
References: 
 >NSTableView view based full width view (From: Jonathan Mitchell <email@hidden>)
 >Re: NSTableView view based full width view (From: Kyle Sluder <email@hidden>)
 >Re: NSTableView view based full width view (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: registerNib:forHeaderFooterViewReuseIdentifier: assert
  • Next by Date: Re: NSTableView view based full width view
  • Previous by thread: Re: NSTableView view based full width view
  • Next by thread: Re: NSTableView view based full width view
  • Index(es):
    • Date
    • Thread