• 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 - Alternating blue and white background
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView - Alternating blue and white background


  • Subject: Re: NSTableView - Alternating blue and white background
  • From: Stéphane Sudre <email@hidden>
  • Date: Tue, 17 Dec 2002 11:38:43 +0100

On mardi, dic 17, 2002, at 11:05 Europe/Paris, Cristi Savu wrote:

Easy,
subclass you NSTableView and use something like this :

[...]


- (void) drawRow:(int) rowIndex clipRect:(NSRect) clipRect
{
if ((rowIndex % 2 == 0) && ([self selectedRow] != rowIndex))
{
NSColor* bgColor =[NSColor colorWithCalibratedRed:0.97 green: 0.97 blue: 0.97 alpha: 0.97];
NSRect rect= [self rectOfRow: rowIndex];
[bgColor set];

NSRectFill(rect);
}
[super drawRow: rowIndex clipRect: clipRect];
}

This is not working for the full table view

and

On mardi, dic 17, 2002, at 11:03 Europe/Paris, email@hidden wrote:

You need to implement the tableviews delegate method -

- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell
forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex

you change the properties of the cell that is about to be drawn there .
Search the archives on this topic, theres quite a few snazzy code
snippets for doing stuff like this.

This not working either.

-------

These 2 solutions are only displaying the stripped background when there is a record for the row.

If you want to display a stripped background on the whole tableview (even when there is not enough lines to fill it), you need to use other solutions.

One solution is described in some Mac Tech articles written by Dan Wood. The code is available on his web site and IIRC, if you search the archive you should find a post indicating the URL of the source codes.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: NSTableView - Alternating blue and white background (From: Cristi Savu <email@hidden>)

  • Prev by Date: Re: NSTableView - Alternating blue and white background
  • Next by Date: Using image as a mask
  • Previous by thread: Re: NSTableView - Alternating blue and white background
  • Next by thread: Re: NSTableView - Alternating blue and white background
  • Index(es):
    • Date
    • Thread