can't get correct NSScrollView tiling with rulers

Hell,

I'm making a macOS app with an NSScrollView showing a vertical ruler (subclass of NSRulerView). I want its clipview to fill the remaining space left by the ruler, I don't want it to be drawn underneath.

Apple says this about the contentInsets property:

When the value of this property is equal to NSEdgeInsetsZero, traditional tiling is performed. Rulers, headers, and other subviews are tiled with the contentView frame filling the remaining space. When the value of this property is not equal to NSEdgeInsetsZero, the rulers, headers, and other subviews are inset as specified. The contentView is placed underneath these sibling views and is only inset by the scroll view border and non-overlay scrollers.

I get the later result. The clipview is placed underneath the ruler, even though my NSScrollView subclass implements this :

-(void)awakeFromNib 
    [self setHasVerticalRuler:YES];
    [self setRulersVisible:YES];
    self.automaticallyAdjustsContentInsets = NO;
    self.contentInsets = NSEdgeInsetsMake(0, 0, 0, 0);
}

If I specify positive insets (for example 10 instead of zeros), the scrollers are moved from the edges, which means the above code is executed.

I can override the -tile command to get the tiling I want, but then the scrollview would scroll the document view too far (showing the srollview background at the left) to make sure that no content is hidden by the ruler (which cannot happen with my custom tiling).

Any ideas?

Ok, it turns out that if I send the last two messages above to the clipView with

self.contentView.automaticallyAdjustsContentInsets = NO;
self.contentView.contentInsets = NSEdgeInsetsMake(0, 0, 0, 0);

AppKit no longer tries to scroll the view too far. But the clipView still shows behind the rulers, as opposed to what the documentation says. At least, I can do my custom tiling.

can't get correct NSScrollView tiling with rulers
 
 
Q