#StackBounty: #xcode #macos #nstableview #appkit NSTableView selected row flickering while scrolling with arrow keys

Bounty: 200

I have a view based NSTableView and can’t figure out how to work around a visual glitch where the currently selected row flickers while scrolling up or down with the arrow keys.

The selected row should appear ‘glued’ to either the top or bottom of the view, depending on scroll direction. The Finder shows this correct behavior in list view but a regular table view seems to not behave this way out of the box. I’m confused as to why that is and see no obvious way to circumvent it. Can anybody point me to possible causes / solutions?

Edit No. 1

A cell based NSTableView behaves in the desired way by default, so this is presumably a bug specific to the view based implementation. I don’t want to use a cell based table for unrelated reasons though.

Edit No. 2

I’ve tried making the table view’s parent view layer backed, as well as intercepting the up / down arrow keystrokes to do my own scrolling, but so far I haven’t been able to eliminate the flickering.

Edit No. 3

I’ve created a small sample project that reproduces the issue.

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.