• 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: Question on NSScrollView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on NSScrollView


  • Subject: Re: Question on NSScrollView
  • From: Varun Chandramohan <email@hidden>
  • Date: Fri, 02 May 2014 06:03:32 +0000
  • Thread-topic: Question on NSScrollView

I ran 'tableView:viewForTableColumn and it is always tableColumn == nil as I have just 1 column. I noticed that I never hit anything that is not "GroupCell". However this does not solve the grey background right?

Also I tried [ltableView setSelectionHighlightStyle:  NSTableViewSelectionHighlightStyleSourceList];
It at least gets me the blue highlight colour. However there is some weird blue background now.
http://snag.gy/a1AC3.jpg is how it looks now. Still not a white background.

Regards,
Varun

From: Quincey Morris <email@hidden<mailto:email@hidden>>
Date: Friday, 2 May 2014 3:12 pm
To: Development <email@hidden<mailto:email@hidden>>
Cc: Cocoa dev <email@hidden<mailto:email@hidden>>
Subject: Re: Question on NSScrollView

On May 1, 2014, at 17:25 , Varun Chandramohan <email@hidden<mailto:email@hidden>> wrote:

Yes I have implemented tableView:isGroupRow.
- (BOOL)tableView:(NSTableView *)tableView isGroupRow:(NSInteger)row {
    DesktopEntity *entity = _tableContents[row];
    if ([entity isKindOfClass:[DesktopFolderEntity class]]) {
        return YES;
    }
    return NO;
}

What is wrong with this?

Nothing at all! Rows corresponding to a 'DesktopFolderEntity' are group rows, and all the others are not.

Also I implemented
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
    DesktopEntity *entity = _tableContents[row];
    if ([entity isKindOfClass:[DesktopFolderEntity class]]) {
        NSTableCellView *groupCell = [tableView makeViewWithIdentifier:@"GroupCell" owner:self];
        [groupCell.textField setStringValue:entity.name];
        return groupCell;
    }
    return nil;
}

Are you saying I should not return nil here?

Well, you are returning nil for rows that aren't 'DesktopFolderEntity', which doesn't seem a good idea, but that isn't the issue you asked about.

In this code, you should return a view with identifier "GroupCell" - as you have done - for rows that are 'DesktopFolderEntity'. Since these are indeed group rows, this correctly gives them the group-row appearance (the one with the gray background).

That is, your table view is showing exactly what you asked it to show.

Your 'tableView:viewForTableColumn:' method is, however, missing some code. You need to return a view for non-group rows (that would probably be a view with identifier 'DataCell', if you have the default setup in IB), and you need to test tableColumn (and possibly tableColumn.identifier). ('tableColumn == nil' means that you're being asked for a group-row view. Otherwise you're being asked for a per-column view.)
_______________________________________________

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: Question on NSScrollView
      • From: Quincey Morris <email@hidden>
References: 
 >Re: Question on NSScrollView (From: Varun Chandramohan <email@hidden>)
 >Re: Question on NSScrollView (From: Quincey Morris <email@hidden>)
 >Re: Question on NSScrollView (From: Varun Chandramohan <email@hidden>)
 >Re: Question on NSScrollView (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Question on NSScrollView
  • Next by Date: Re: Question on NSScrollView
  • Previous by thread: Re: Question on NSScrollView
  • Next by thread: Re: Question on NSScrollView
  • Index(es):
    • Date
    • Thread