You are doing everything right, except for this line:
[ScrollView addSubview: rTableView]
The standard layout of NSScrollView + NSTableView has NSTableView set as documentView for NSScrollView . You correctly configured these relationships programmatically in your code:
[ScrollView setDocumentView: resultsTableView]
When you added the line [ScrollView addSubview: rTableView] , which added the table view in a way that was not intended. Basically, this addition serves only to ensure that you do not see a properly viewed table view that is below it.
Removing this line [ScrollView addSubview: rTableView] should allow you to see the table view correctly and let the scroll mechanisms work properly.
An NSScrollView has many subzones that make up the scroll architecture (see Scroll Programming Guide for Mac ). Examining the standard " NSTableView inside NSScrollView ", available in the Interface Builder palette, shows that there are 4 immediate sights in the scroll view:
"<NSClipView: 0x103507200>", "<NSScroller: 0x101b14f80>", "<NSScroller: 0x101b15210>", "<NSClipView: 0x103507be0>"
One of the clips contains an NSTableView , and the other NSTableHeaderView . Using NSScrollView setDocumentView: in the line [ScrollView setDocumentView: resultsTableView] correctly configure the table view as the corresponding view of the NSClipView document. On the other hand, adding a table view as a direct subset of NSScrollView will produce unexpected results that you see.
source share