12

I am looking to remove the separator color in View based NSTableView.

It looks like this :

enter image description here

For UITableView there is a method setSeparatorColor: but not for NSTableView.

Solutions will be highly appreciated.

Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140

4 Answers4

15

I did this as:

Changed the Intercell spacing to :

[aTableView setIntercellSpacing:NSMakeSize(0, 0)];

And changed the height of the the cell, set view's width to 30.f , the cell being drawn is of 35.f.

Now it is perfect, screen shot :

enter image description here

Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140
10

For NSTableView, Interface Builder has settings for Horizontal Grid, Vertical Grid, and Grid Color. These are reflected in the API as -setGridStyleMask and setGridColor.

They do exactly what you want.

[table setGridColor:[NSColor clearColor]];
[table setGridStyleMask:NSTableViewGridNone];
Thomas Freudenberg
  • 5,048
  • 1
  • 35
  • 44
Steve Waddicor
  • 2,197
  • 15
  • 20
  • I wanted transparent color. – Anoop Vaidya May 06 '13 at 09:59
  • If you set the grid to none, the only color will be your background color, just as you asked for. If you had wanted it to be another color, you could of course set it to a different partially transparent colour. Any colour can have a transparency set (alpha). – Steve Waddicor May 06 '13 at 10:19
  • I checked with this way, still it shows in view based tableview :( – Anoop Vaidya May 06 '13 at 10:22
  • OK, I tested this out with a view based table. Cocoa draws the grid on top of the table cell. So the only colour that would make the grid disappear would be 0% alpha. But setting the grid to none doesn't draw the grid at all, so that can't be visible. So it could only be that it was gaps between the views that were showing for you (but not me). I guess that's why intercell spacing and/or changing the height of your cell views worked for you. – Steve Waddicor May 06 '13 at 10:35
  • not only intercell, i had to implement both (increaed the view height too) – Anoop Vaidya May 06 '13 at 10:37
5

Answer for Interface Builder :

enter image description here

Vladimir
  • 1,053
  • 10
  • 8
3

Maybe I could mention that in view based tables NSTableRowView is responsible for drawing the seperators. So in the inspector for the table you set it the grid to "None" and implement drawSeparatorInRect: in your NSTableRowView subclass, which in your case would mean leaving it empty.

aLevelOfIndirection
  • 3,522
  • 14
  • 18