CALayer "floating" within NSScrollView?

47 Views Asked by At

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.

1

There are 1 best solutions below

0
jeanlain On

As it turns out, the solution was simple.

The layer was masked by the scrollview's subviews (namely, its contentView). I simply changed the layer zPosition property to a positive value, and the layer now shows.