CALayer “floating” within NSScrollView?

Issue

This Content is from Stack Overflow. Question asked by jeanlain

I’d like to have a CALayer “float” over my scroll view’s documentView. That is, it shouldn’t move during scrolling.

If I add a CALayer to my NSSCrollView‘s layer, the added layer is masked by the clipview: in only shows where the scrollers are.
Adding the layer to the clipview doesn’t work either. It’s masked.

I could add the layer to the document view and compensate the scrolling so that it stays in place, but that would be inelegant.



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?