Hi,
I add vibrancy effect to my window using the following code:

In the view class:
- (void)awakeFromNib {
NSVisualEffectView* vibrantView = [[NSVisualEffectView alloc]
initWithFrame:self.frame];
vibrantView.appearance = [NSAppearance
appearanceNamed:NSAppearanceNameVibrantLight];
[vibrantView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[self addSubview:vibrantView];
}

It uses default blending mode (which is
NSVisualEffectBlendingModeBehindWindow), and this is what I need.

Problem: the vibrancy effect goes right to the bottom of the desktop,
i.e. the color of desktop background color shines through (even if
there are some other windows in the way!).

The effect that I need is to have the transparency effect include only
the top visible window, this is how NSPopover works:

In view controller:
@interface PopoverController : NSViewController {
}
@end
@implementation PopoverController
- (void)loadView {
    self.view = [[NSView alloc] initWithFrame:NSMakeRect(10,10,100,100)];
}
@end
- (void) viewDidAppear {
    NSPopover* popover = [[NSPopover alloc] init];
    PopoverController* controller =[[PopoverController alloc] init];
    [popover setContentViewController:controller];
    [popover setBehavior:NSPopoverBehaviorTransient];
    [popover showRelativeToRect:self.view.bounds ofView:self.view
preferredEdge:NSMaxYEdge];
}

The popup that is created gets the vibrancy effect only from the
window that is right below it.

Any ideas on how to make it work for custom window?

Thanks,
Jacek
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to