Reputation: 533
I have an NSView
in interface builder like so:
I have buttons and a label inside the view (videoView) for playback control of a video. When I add an AVPlayerLayer
(myPlayerLayer) to the view like so:
self.videoView.layer?.addSublayer(myPlayerLayer)
It adds the AVPlayerLayer
as the top layer, thereby covering the buttons. How can I add the playerlayer to the back so it doesn't cover any of the other content?
Thanks a lot.
Upvotes: 2
Views: 1499
Reputation: 533
By doing:
myPlayerLayer.zPosition = -1
I forced the AVPlayerLayer
to be behind any other existing layers already in the NSView
. Note that setting zPosition
to 0
does not work; I believe the buttons and labels were at 0
and so I needed to go further back.
Upvotes: 8