I want to put a text label over a scroll table but the label conflicts with the drawing of the scrolling. Here you can see a test where I've intentionally put the label half out of the table and scroll up in the table, which results in the part of the label overlay being dragged below until it exits the window.

Also, when I go to the other end of the table and scroll down, sometimes the label seems to be redrawn and chunks of it go up along with the scroll:


It seems that the table is redrawing its contents and does not notify the rest of the view objects to redraw themselves in case they are overlaid. How do I solve this? In fact, this seems highly related to How to place an NSButton over an NSTableView which seems to have the same problem but with a button instead of a label.
Dont do that because you will lose a lot of performance and increase energy use.
Try the NSScrollView method
- (void)addFloatingSubview:(NSView *)view forAxis:(NSEventGestureAxis)axis
Another alternative way to get proper redrawing is to open the xib root view in the Effects Inspector, and mark it to use the Core Animation Layer. This avoids requiring to create a custom class with the redrawing hook.
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