7
votes

I have a NSTableView that shows some images and a text in every row. I enabled multiple Selection for NSTableView. And I enabled Drag&Drop for TableView to sort or export the images. It now happens that, when I select more than one row, and dragging them over the TableView, that the whole row gets blue and remains blue (selected). Text and images can not been seen. In XCode I get this message:

Layout still needs update after calling -[NSTableRowView layout]. NSTableRowView or one of its superclasses may have overridden -layout without calling super. Or, something may have dirtied layout in the middle of updating it. Both are programming errors in Cocoa Autolayout. The former is pretty likely to arise if some pre-Cocoa Autolayout class had a method called layout, but it should be fixed.

The problem only exists for multiple Selection. When enabling single Selection it works fine.

Here are three pictures to demonstrate the problem:

Picture 2: When dragging over it gets complete blue; overriding the other layout components

http://ekiwi.de/temp/stackoverflow/original2.png

Picture 3: After Dragging it remains fully blue

http://ekiwi.de/temp/stackoverflow/original3.png

Until now I didn't find any solution or hint by googling two days. Perhaps here somebody have a hint?

1
Did you get anywhere with this? I have a similar issue with NSOutlineView. In my case I can get around the issue by changing the highlight style to source list. I've also recreated it in an extremely simple test project so I suspect this is an Apple bug and have filed a Radar.Gavin Maclean
I've also run across this bug in my own app, which uses a view based NSOutlineView. The only additional bit of info I can add is that, for my app at least, this bug only occurs on Yosemite, and not Mavericks. Gavin, if you still have that test project around from your radar, would you mind posting a copy somewhere?Brian Webster
any solution for this?Duck

1 Answers

1
votes

I was finally able to override the blue selection color by setting the selectionHighlightStyle of the row view. The following code in my NSTableRowView subclass did the trick:

- (NSTableViewSelectionHighlightStyle)selectionHighlightStyle
{
    return NSTableViewSelectionHighlightStyleNone;
}

- (void)drawSelectionInRect:(NSRect)dirtyRect
{
    [[NSColor redColor] set];
    NSRectFill(dirtyRect);
}