Yes, it seems that NSTableView caches the drawing of the hole table, so the scroll does not need to be updated for each pixel. However, this is exactly what is needed. Fortunately, this can be done, I was able to subclass NSScrollView as follows to add a property and binding to reflectScrolledClipView: ::
@interface EHScrollView : NSScrollView @property (nonatomic, weak) NSView *refreshView; @end
The implementation will be as follows:
#import "EHScrollView.h" @implementation EHScrollView - (void)reflectScrolledClipView:(NSClipView *)aClipView { [super reflectScrolledClipView:aClipView]; [self.refreshView setNeedsDisplay:YES]; } @end
The only thing needed is to change xib for the user interface. When the table is embedded in the scroll view, select the scroll and modify it to inherit the custom EHScrollView class. Then, in the initialization of the view controller, use the outputs for both the scroll view and the table view, to associate the latter with the former using the refreshView property.
Now, each individual scroll will automatically call setNeedsDisplay: on the refreshView , which means that both the table and everything that is superimposed on top will be redrawn. Of course, this works more intensively than a non-refreshing table, so use it only where it makes sense.
source share