I have an NSTableView embedded within a custom NSScrollView subclass, wherein I sometimes do scrolling programmatically, like so:
[[self contentView] scrollToPoint:newOffset];
[self reflectScrolledClipView:[self contentView]];
When I do this, the NSTableView scrolls fine, but its associated NSTableHeaderView doesn’t move with it. If I use my mouse and scroll the NSScrollView normally, however, they move together like they should.
I figure I’m probably just missing a single line somewhere that lets the NSTableHeaderView know that it’s supposed to scroll too, but I don’t know what that is. Can anyone help?
Well, I don’t know precisely what kind of black magic goes on under the hood when you scroll an
NSScrollViewcontaining anNSTableHeaderViewwith the mouse, but it looks like it handles it internally somewhere. To circumvent this, I now only scroll theNSTableViewprogramatically (by overriding the functions that would handle user input), and then I scroll theNSTableHeaderViewmyself, like so: