Benches Uncategorized

1

NSWindow transparency

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

The method -setAlphaValue: of NSWindow seems to change the alpha value of the whole window, as described in the documentation: "Applies a given alpha value to the entire window".

In my case, i want to have a transparent background but opaque foreground. For example, an NSWindow entirely transparent with its content view components opaque.

I don't see how it can be done with standard cocoa methods.

how do I do it with Cocoa ?

1 reply

Sign in or join Beachball Help to reply.

  1. 0

    Sebastien Z

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Finally i've founded an old sample code provided by Apple which show how to perform this task:

    http://developer.apple.com/samplecode/RoundTransparentWindow/index.html

    The magic happens in these two lines of code :

    [aWindow setBackgroundColor:[NSColor clearColor]]

    [aWindow setOpaque:NO]