R
R
ruman2012-10-10 20:06:04
Cocoa
ruman, 2012-10-10 20:06:04

How to make a window transparent?

Is it possible to make a window completely transparent, but all the controls located inside this window must be visible?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
spayeler, 2012-10-10
@ruman

@implementation MyCustomWindow

- (id)initWithContentRect:(NSRect)contentRect
                styleMask:(NSUInteger)windowStyle
                  backing:(NSBackingStoreType)bufferingType
                    defer:(BOOL)deferCreation
{
    self = [super
            initWithContentRect:contentRect
            styleMask:NSBorderlessWindowMask
            backing:bufferingType
            defer:deferCreation];
    if (self)
    {
        [self setOpaque:NO];
        [self setBackgroundColor:[NSColor clearColor]];
    }
    return self;
}

@end

Similar questions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question