I have an NSScrollView with an NSTableView inside.
As you can see, there is a 100px high NSView that overlays the table view. (This is done intentionally, the overlay is slightly transparent and you can see a shadow of the table view scroll underneath).
The problem of course is that I need to add 100px of empty space to the bottom of the scroll view to compensate for the overlay. Otherwise you can't see the bottom of the table, it gets covered up by the overlay.
I've tried modifying the clip view, but seem to only be able to change its frame (losing the transparent overlay effect).
Maybe I'm not doing it quite right, please help!
Ok so I figured it out, I needed to consistently enlarge the documentView
frame.
The best way I found to do this was to subclass the document view, which in this case is the NSTableView.
In the subclassed NSTableView I overrode the setFrameSize:(NSSize)newSize
- (void)setFrameSize:(NSSize)newSize {
newSize.height += 100;
[super setFrameSize:newSize];
}
Which added 100px of padding to the bottom of the table view and thus the scroll view.
Here's the same thing in Swift 4:
class TableViewPadded: NSTableView{
//Add padding at bottom
override func setFrameSize(_ newSize: NSSize) {
let padded = NSSize(width: newSize.width, height: newSize.height+30)
super.setFrameSize(padded)
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With