• 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
Alternate row colors and selection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Alternate row colors and selection


  • Subject: Alternate row colors and selection
  • From: Ivan C Myrvold <email@hidden>
  • Date: Tue, 25 Mar 2008 08:34:16 +0100

I have an NSOutlineView, where the cells in one of the columns are NSButtonCell.
In the delegate method outlineView:willDisplayCell:forTableColumn:item:, I am setting the alternate colors with


if ([te isColored]) // even row number
   [aCell setBackgroundColor:evenColor];
else
   [aCell setBackgroundColor:[NSColor whiteColor]];

This works fine for the columns which have NSTextFieldCell, and it also colors the column with the NSButtonCell,
but when I select a row, the column with NSButtonCell still have the color as set above, and not the selection color.


This looks weird, as all the other columns have the selection color, and there is a gap for this column.

How do I fix this? If I set the "Alternating Rows" in IB, the selection color is fine for all the columns, but I can't use that as I have some special requirements of the coloring.

Ivan
_______________________________________________

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: Alternate row colors and selection
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Issues implementing [NSArrayController replaceObjectsAtArrangedObjectIndexes: withObjects:]
  • Next by Date: Convert kernel AbsoluteTime to a NSDate
  • Previous by thread: Re: Issues implementing [NSArrayController replaceObjectsAtArrangedObjectIndexes: withObjects:]
  • Next by thread: Re: Alternate row colors and selection
  • Index(es):
    • Date
    • Thread