Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transparent layer-backed views

I'm trying to perform some simple animations using CA layers on transparent window and corresponding view. The problem I have is that every time I turn on the layer backing (either through wantsLayer in code, or with IB) the view stops being transparent.

I've tried setting layer's backgroundColor to something with low alpha and I took few other rather obvious approaches, but it looks to me that I'm missing something.

To illustrate the problem better, let's just use sample Round Transparent Window project from developer.apple.com. With layer added (just this single line in awakeFromNib), the transparency goes away http://slonce.com/layers.png

Could anyone please give me some hints on this?

like image 563
kodz Avatar asked May 17 '26 11:05

kodz


1 Answers

Thanks to Dave Keck from cocoa-dev, the answer is:

[window setBackgroundColor: [NSColor clearColor]];
like image 73
kodz Avatar answered May 19 '26 04:05

kodz